We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I don't know why when I export this code and run the app, it doesn't launch, but it works fine when I compile it. Anyone knows what's the problem of this one?
import processing.serial.*; Serial port;
void setup() {
port = new Serial(this, Serial.list()[0], 9600); // Open the port that the Arduino board is connected to, at 9600 baud
}
void draw() {
String onoroff[] = loadStrings("C:/xampp/htdocs/DoorlockTest/LEDstate.txt"); // Insert the location of your .txt file
print(onoroff[0]); // Prints whatever is in the file ("1" or "0")
if (onoroff[0].equals("1") == true) {
println(" - TELLING ARDUINO TO TURN LED ON");
port.write('H'); // Send "H" over serial to set LED to HIGH
} else {
println(" - TELLING ARDUINO TO TURN LED OFF");
port.write('L'); // Send "L" over serial to set LED to LOW
}
delay(1000); // Set your desired interval here, in milliseconds
}
anyway credits to the programmer of this code.
Answers
See Import Serial Doesnt Work When Exporting Application which you found yourself...
Never mind, I got the solution for this, new released version of processing, the 3.0a2 worked!!!! Thank goodness! :D
LOL we commented at the same time XD anyway, yeah I got it :D Thanks.