A web server which monitors the serial port for light data, converts it to lux, then graphs it on the client. In order to install your dependencies, run "npm run install-all", after which you can build and run your application. The command "npm start" will build and run the app (which must be run the first time, or after any changes), while "node index.js" will just run it.
Note: this server requires that you have node and npm installed.
//change this to match whichever analog input pin you use.
int lightPin=A0;
//the delay time between updates
int dv=250;
int lightVal;
void setup() {
// put your setup code here, to run once:
pinMode(lightPin, INPUT);
// 9600 is the baud rate
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
lightVal = analogRead(lightPin);
Serial.println(lightVal);
delay(dv);
}
The lux conversion mechanism will likely still need to be updated, even with a similar setup to ours.