Hey Victor,
Protocoder is awesome!
Im using it for a project of mine and I have two questions.
First, half the time when I run this bit of code
var arduino = boards.startArduino(9600, function(data) {
I get the error "null pointer exception"
Is their any way that I can get rid of this error.
Second, I'm using protocoder to read a file on an http server and then forward that data over serial port to an arduino.
This program is able to do that(at least when it doesnt get the null exception error).
//read from http server
network.httpGet("http://192.168.1.105:801/keyLog.txt", function(status, response) {
var text = ui.addText(" ", 0, 0);
//set up arduino
var arduino = boards.startArduino(9600, function(data) {
text.setText(data);
});
//make variable equal to contents of file on http server
var x = response[0];
//write character to arduino over serial port
if(x == "w"){
arduino.write("w");
}
else if(x=="a"){
arduino.write("a");
}
else if(x == "s"){
arduino.write("s");
}
else if(x == "d"){
arduino.write("d");
}
else if(x == " "){
arduino.write(" ");
}
else{
arduino.write("j");
}
});
I now want this program to repeat infinitely.
I tried to put the program in a while loop like this but the it crashes when I try to run it.
var text = ui.addText(" ", 0, 0);
var arduino = boards.startArduino(9600, function(data) {
//make variable equal to contents of file on http server
//write character to arduino over serial port
Is their any way that I can repeat the program infinitely.
Sorry for such a long post.
Swaleh