Simple LED Test
at the start i want to make this project just like this, but the code make me give up, so I make it more simple as i can.
Step 1 - the Things You Need
this is the things you need
LED 10
Bread 1
USB cables 1
Buttons 1
Wire 14
Resistor 2
How It Looks Like
put them like the picture up there
Code
this is the code I used:
const int buttonPin = 13; int buttonState; void setup() { // put your setup code here, to run once: for (int i=1; i<14 ; i++){ pinMode(i, OUTPUT); pinMode(buttonPin, INPUT); Serial.begin(9600); }} void loop() { // put your main code here, to run repeatedly: buttonState = digitalRead(buttonPin); for (int i=1; i<14; i++){ digitalWrite(i,HIGH); digitalWrite(i-1,LOW); delay(500); if(buttonState==HIGH && i==6){ Serial.println("You Win"); } }}
Done
this is the project I made at start, if you think mine one is to easy you can try this one.