I have an Arduino scripted to output a "1" to a serial port when a push-button is pressed (and I have confirmed that this works by using a terminal to read traffic on the port). I wrote a Processing script to listen for traffic on the port, and I want it to open and run a Perl script if it finds anything other than a 0.
I know the Processing script is reading the traffic; but when I press the button on the Arduino the script print's "49" (why 49 and not 1 I don't know) and it doesn't open my perl script. It also seems to slow my computer down until I stop the script. Any ideas?
Here is my Script:
import processing.serial.*; // The serial port: Serial myPort; void setup() { // List all the available serial ports println(Serial.list()); // Open the port you are using (COM3) at the rate you want: myPort = new Serial(this, Serial.list()[1], 9600); } void draw() { while (myPort.available() > 0) { int inByte = myPort.read(); println(inByte); if (inByte != 0) { String file_name = "C:/scripts/test.pl"; open(file_name); } } }