PyQt App for Arduino
#define led 13
#define baud 9600
void setup() {
pinMode(led, OUTPUT);
Serial.begin(baud);
}
void loop() { }
void serialEvent(){
if (Serial.available() > 0){
//
String command = Serial.readStringUntil('\n');
//Sending a reply after executing the function
if (command.equals("on")) { digitalWrite(led, HIGH); Serial.println("LED ON"); }
else if (command.equals("off")) { digitalWrite(led, LOW); Serial.println("LED OFF"); }
}
}