Hey guys I was reading this tutorial over here: /projects/posts/how-to-led-arduino-php-proc/
I followed that tutorial but there's a problem.
I am using zymichost to host my free website with php enabled and it seems that the php code is working because it DOES change the value in LEDstate.txt when you click on or off. The thing is that in the processing window it keeps saying that it's turning off the LED cause there's no value. here's the processing code:
/*
A simple Processing script for enabling or disabling the LED on an Arduino using a web interface and serial communication.
Author: Sindre Lindstad
Created: 19th of January 2011
http://projects.sindrelindstad.com
*/
import processing.serial.*;
Serial port;
void setup() {
/* This part must be altered to fit your local settings. The number in brackets after "Serial.list()" is where you declare what COM port your Arduino is connected to.
If you get error messages, try a different number starting from 0 (e.g. 0, 1, 2, 3...) . */
port = new Serial(this,"COM3", 9600); // Open the port that the Arduino board is connected to, at 9600 baud
}
void draw() {
String onoroff[] = loadStrings("http://adamlight.zymichost.com/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(5000); // Set your desired interval here, in milliseconds
}
so basically it's not detecting whether on/off equals true or not.
If you check the website I'm hosting and you type "/LEDstate.txt" on the end then it will show a value of 1 or 0 like it should when you press the buttons. I don't know what is wrong. Here's the website: http://adamlight.zymichost.com/index.html