Part 1 – Disco Mode Light

Matthew Au-Yeung

Disco Mode Light

I started off with playing around with photo resistor and LEDs.

Using serial monitor to understand what the photo resistor is actually doing.

Disco Mode Light in working state

The sketch I used

int ledpin=4;

void setup()
{
Serial.begin(9600);
pinMode(ledpin, OUTPUT);
}
void loop()
{
int sensorValue = analogRead(A0);
if (sensorValue < 200) // Turn on the light if it is less that 200
{
digitalWrite(ledpin, HIGH);
}
else {
digitalWrite(ledpin,LOW);
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s