Skip to content

Instantly share code, notes, and snippets.

@stefania11
Created October 29, 2013 17:25
Show Gist options
  • Save stefania11/7219040 to your computer and use it in GitHub Desktop.
Save stefania11/7219040 to your computer and use it in GitHub Desktop.
#Here's an awesome Robot project
### duration project: 2h
Materials list
1. Arduino uno
2. light sensor
3. cardboard
##how to
1. Step 1
![alt text](http://www.slipperybrick.com/wp-content/uploads/2009/08/little_ken.jpg "Overview Robot")
2. Step 2
<br>
<b>Markdown works *fine* in here.</b>
3. Step3 Arduino code
<br>
<!-- language: arduino# -->
void setup()
{
Serial.begin(9600); //start the serial monitor with 9600 baud
pinMode(13, OUTPUT); //we mostly use13 because there is already a built in yellow LED in arduino which shows output when 13 pin is enabled
}
void loop()
{
LDRValue = analogRead(LDR); //reads the ldr’s value through LDR which we have set to Analog input 0 “A0″
Serial.println(LDRValue); //prints the LDR values to serial monitor
delay(50); //This is the speed by which LDR sends value to arduino
if (LDRValue < light_sensitivity)
{
digitalWrite(13, HIGH);
}
else
{
digitalWrite(13, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment