1
My code gives me an error in a definition of a variable but I think it is declared the variable bits_rx
, this variable aims at the result of the conversion:
while(1):
while not radio.available(0):
time.sleep(1 /100)
receivedMessage= []
radio.read(receivedMessage, radio.getDynamicPayloadSize())
string = ""
for n in receivedMessage:
string += chr(n)
ascii=convert_to_ascii(string)
ascii_aux2=np.array(ascii)
bits_rx=dec_to_bin(ascii)
print("Bits(recebidos)=",' '.join('{:04b}'.format(n) for n in ascii))
erros=np.sum(np.array((bits-bits_rx)!=0, dtype=int))
print("Erros= ", erros)
What language is that? I believe it is
Python
then take a look at that answer: What’s wrong with the indentation of this python code?– NoobSaibot
yes it’s python, but bits_rx can be declared like this can’t?
– Sergio Nunes
yes, check the identation
– NoobSaibot
I’ve been around the indentation and it always makes the same mistake!!
– Sergio Nunes
Has two
while
at the same indentation level there.– Woss
how can I re-edit and put the right code? as I have it in the Raspberry IDLE
– Sergio Nunes
Below the code in the question is tags and below the tags you have the edit option, or edit
– NoobSaibot
Okay, thanks, I already put the code, the error continues to give me
– Sergio Nunes
Which error message is complete and the line?
– Guilherme Nascimento
I have already found the problem of being in error, it was one of the emitters that was damaged and hence give error, I appreciate the help provided in it.
– Sergio Nunes