I'm trying to control a Roomba (iRobot Create 2) which has a open interface command. I'm able to control it with Arduino with the following lines:
Serial.begin(115200);
Serial.write(byte(128)); // Starts communication
delay(50);
Serial.write(byte(132)); // Enter full access to roomba mode
Serial.write(byte(137)); // Command for driving
Serial.write(byte(0x00)); // The rest is the driving configuration for Spin counter clockwise
Serial.write(byte(0xc8));
Serial.write(byte(0x00));
Serial.write(byte(0x01));
Now, I'm trying to do the same with Raspberry Pi 3b+, but I can't find the equivalent function for Python. Can I get some help?
There is no point in trying to translate individual bits of a language to another, as there might not be an equivalent thing or there would be a better way.
In this case the whole thing in Python would be:
import serial, time
ser = serial.Serial('/dev/ttyS0', 115200)
ser.write(bytes([128]))
time.sleep(0.05)
ser.write(bytes([132,137,0x00,0xc8,0x00,0x01]))