Hi guys! I'm new to the Arduino. Right now I'm creating a sketch that will light up the led lights:
From left to right, one by one
From right to left, one by one
All odd numbered lights first, then all even numbered lights, run 5 times
After verifying the code, I'm getting this error messages which is:
Arduino: 1.8.1 (Windows 8.1), Board: "Arduino/Genuino Uno"
C:\Users\Kenneth\Documents\Arduino\sketch_jan14a\Lab1Abuel.ino: In function 'void setup()':
C:\Users\Kenneth\Documents\Arduino\sketch_jan14a\Lab1Abuel.ino:1:6: error: redefinition of 'void setup()'
void setup() {
^
C:\Users\Kenneth\Documents\Arduino\sketch_jan14a\sketch_jan14a.ino:1:6: note: 'void setup()' previously defined here
void setup() {
^
C:\Users\Kenneth\Documents\Arduino\sketch_jan14a\Lab1Abuel.ino: In function 'void loop()':
C:\Users\Kenneth\Documents\Arduino\sketch_jan14a\Lab1Abuel.ino:16:6: error: redefinition of 'void loop()'
void loop() {
^
C:\Users\Kenneth\Documents\Arduino\sketch_jan14a\sketch_jan14a.ino:16:6: note: 'void loop()' previously defined here
void loop() {
^
exit status 1
Error compiling for board Arduino/Genuino Uno.This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Here's my code:
void setup() {
// put your setup code here, to run once:
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(14, OUTPUT);
pinMode(15, OUTPUT);
pinMode(16, OUTPUT);
pinMode(17, OUTPUT);
pinMode(18, OUTPUT);
}
void loop() {
digitalWrite(11, HIGH);
delay(1000);
digitalWrite(11, LOW);
delay(1000);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(12, LOW);
delay(1000);
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
digitalWrite(14, HIGH);
delay(1000);
digitalWrite(14, LOW);
delay(1000);
digitalWrite(15, HIGH);
delay(1000);
digitalWrite(15, LOW);
delay(1000);
digitalWrite(16, HIGH);
delay(1000);
digitalWrite(16, LOW);
delay(1000);
digitalWrite(17, HIGH);
delay(1000);
digitalWrite(17, LOW);
delay(1000);
digitalWrite(18, HIGH);
delay(1000);
digitalWrite(18, LOW);
delay(1000);
digitalWrite(18, HIGH);
delay(1000);
digitalWrite(18, LOW);
delay(1000);
digitalWrite(17, HIGH);
delay(1000);
digitalWrite(17, LOW);
delay(1000);
digitalWrite(16, HIGH);
delay(1000);
digitalWrite(16, LOW);
delay(1000);
digitalWrite(15, HIGH);
delay(1000);
digitalWrite(15, LOW);
delay(1000);
digitalWrite(14, HIGH);
delay(1000);
digitalWrite(14, LOW);
delay(1000);
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(12, LOW);
delay(1000);
digitalWrite(11, HIGH);
delay(1000);
digitalWrite(11, LOW);
delay(1000);
for(int i = 1; i < 6; i++)
{
digitalWrite(11,HIGH);
digitalWrite(13,HIGH);
digitalWrite(15,HIGH);
digitalWrite(17,HIGH);
delay(1000);
digitalWrite(11,LOW);
digitalWrite(13,LOW);
digitalWrite(15,LOW);
digitalWrite(17,LOW);
digitalWrite(12,HIGH);
digitalWrite(14,HIGH);
digitalWrite(16,HIGH);
digitalWrite(18,HIGH);
delay(1000);
digitalWrite(12,LOW);
digitalWrite(14,LOW);
digitalWrite(16,LOW);
digitalWrite(18,LOW);
}
}