Ok i want to tell my robot to move and turn up and down turn the ultra sonic give the distance etc! but im not sure how to do it! in Python i would do something like leftmotorvalue | rightmotorvalue but im not sure ow to do it in arduino as i don't know how to split them etc, i checked websites like tutorialspoint they only covered stuff like appending etc!
and also Serial.read() returns int, im not sure how to even use the functions on them! can anyone help me?
PaulS:
What stuff is limited? Why does the fact that Serial.read()'s return type is int cause you heartburn?
And the problem is?
From where? In what format?
Not without having saved "them" (whatever them is) in some container that python knows how to split.
i don't know how to do stuff with int! you know! how does a character get in an int anyway
i don't know how to do stuff with int! you know! how does a character get in an int anyway
I'll ask a different question. Why does Serial.read() return an int, when the documentation says it reads a byte from the serial port?
The answer is that Serial.read() needs some way to say "Hey, bozo, there was nothing to read!". It can't do that in a byte, because every value in a byte is legitimate data.
So, it returns an int, so that it can send an error code. If you always use Serial.available() to determine that there is data to read, before calling Serial.read(), you could store the return value in a byte-sized variable, such as bool, uint8_t, byte, or char.