0

I am writing a program for a client that receives a string of an average from a server through the built in radio of averages which the client records. I get a ValueError saying "invalid syntax for integer with base 10" in a line where I attempt to convert a string saved into a variable into an integer. I was able to do this with no errors in a line above the line with an error.

my code is below:

from microbit import *
import radio

radio.on()

blink = Image("99999:"
              "99999:"
              "99999:"
              "99999:"
              "99999")

radio.send("power on")

while True:
    sleep(50 - running_time() % 50)
    acceleration = accelerometer.get_z()
    acceleration = int(acceleration)
    radio.send(str(acceleration))

    incoming = radio.receive()
    if incoming is not None:
        incoming = int(incoming)

    while acceleration > (2 * incoming) or acceleration < (.5 * incoming):
        display.show(blink)
        sleep(300)
        display.clear()
        sleep(300)

the line with the error is

incoming = int(incoming)
bk122474
  • 13
  • 1
  • 4

0 Answers0