Introduction: Using Inputs With an Arduino.
Another beginner tutorial for all of you guys who want a little bit more advanced beginner tutorial. We are using inputs for the Arduino so the Arduino can sense the outside world!
Step 1: Materials
For this tutorial we will need a
>simple push button
>An LED with resistors
>and the Arduino IDE
most of this this can be found at a cheap price at your local Radio Shack.
Step 2: The Code
Here is the code. You can copy and paste it to your Arduino IDE or download the file above.
const int button = 6; //setting the button on pin 6...
const int led = 13; //using the seceret led on pin 13...
void setup() {
pinMode
(button, INPUT_PULLUP); //declaring the button as an input to the arduino...
pinMode(led, OUTPUT); //declaring the led as an output to the arduino...
}
void loop() { if(digitalRead(button) == 1){
digitalWrite(led, HIGH);
}else{
digitalWrite(led, LOW);
}
}
Attachments
Step 3: The Schematic
here is the schematic for this tutorial! (you need to download fritzing to view the file)
Attachments
Step 4: Last Step!/other Info.
Once your done assembling the schematic and uploading you code to an Arduino board you should be set!
*my Arduino IDE stopped working(version 1.6.10) so I had to this project of memory please tell me if it doesn't work
and please tell me what tutorial you guys want next!