This is a project form "Getting Started with Arduíno", or at least the main idea was from there.
The goal is to make a LED blink according to the light.
This is what it will look like:
Components:
1 Arduino Duemilanove
1 breadboard
1 LDR
1 Resistence of 10 k ohms +/- 5%
3 wires
1 USB/Arduino cable
1 computer
This is my pseudo-schematic:
Here is my code for this project:
// Light sensitive LED
int val = 0;
void setup(){
pinMode(13, OUTPUT);
}
void loop(){
val = analogRead(0);
digitalWrite(13, HIGH);
delay(val);
digitalWrite(13, LOW);
delay(val);
}
If all goes well you should end up you a project looking like this:

0 comentários:
Enviar um comentário