Demo entry 6314929

ldrex2

   

Submitted by anonymous on Oct 31, 2016 at 21:43
Language: Arduino. Code size: 376 Bytes.

int redPin = 4;
int greenPin = 3;
int sensorPin = 0;


void setup()
{
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
}

void loop()
{
 int blinkRate = analogRead(sensorPin);
 
 if(blinkRate < 400)
 {
   digitalWrite(greenPin, LOW);
   digitalWrite(redPin, HIGH);
 }
 else
 {
   digitalWrite(greenPin, HIGH);
   digitalWrite(redPin, LOW);
 }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).