Home>

I need to get two dynamic numbers with Arduino.

Import Serial
Arduino= Serial.Serial ('COM5', 9600)
While (1== 1):
    if (arduino.inwaiting () >
0):
        MyData= Arduino.ReadLine ()
        Print (MyData)

If you just read the data from the port, they do not differ from each other. Is it possible in some way to get them separately? I need it to move the object through Pygame.

Def Dvijup (Self, Al):
self.keystate= pygame.key.get_pressed ()
if self.acm >
= 10:
    self.acm== KeyState [pygame.k_up]
    Self.speedx= -5
if self.acm <
= 10:
    self.acm== Keystate [pygame.k_down]
    Self.speedx= 5.
self.Rect.y += Self.Speedx

So that from one rangefinder to get some numbers on ACM. And from the other on BCM.

Try to additionally clarify the question. Now it is not clear what is the point. Do you have two digits in a row with Adruino and you want to divide them?

CrazyElf2021-05-04 07:46:39