Using python3 and pyserial on a virtualmachine ,Ubuntu 17.10, Ran the code like this "User@user:$ python3 ardui.py".
I'm trying to get rid of the b' ... /r/n' just get text or string for example , I get this on python b' What's 9+10? /r/n' but Im trying to get only the "What's 9 + 10?" how can i get rid of the other text ?
int PB = 2; //Its just a button that when pressed it gets store in the variable buttonState
void setup(){
Serial.begin(9600);
pinMode(PB, INPUT);
}
void loop(){
int buttonState = digitalRead(PB):
if(buttonState ==1){
Serail.println("What's 9 + 10");
delay(10);
}
else
{
Serial.println("21!");
delay(100);
}
}
And the python code is this one:
import serial
arduinoSerialData = serial.Serial('/dev/ttyACM0',9600)
while (1==1):
if (arduinoSerialData.inWaiting()>0):
myData = arduinoSerialData.readline()
print (myData)