processing - My Arduino automatic LED 'nightlight' is not working -



processing - My Arduino automatic LED 'nightlight' is not working -

i have arduino uno, , i'm trying write programme if photoresistor detects low amount of light, led turns on. here code.

int led = 2; int phores = a4; int val = 0; void setup() { pinmode(led, output); pinmode(phores, input); serial.begin(9600); } void loop() { val = analogread(phores); if(val > 256) { digitalwrite(led, high); } if(val < 256) { digitalwrite(led, low); } serial.println(val); }

you might need set sec if block within loop function. i'm pretty should prepare things. adding little delay might thought avoid doing check @ every iteration.

arduino processing led arduino-ide arduino-uno

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -