I am at my wits-end! I had the same programming error in my attempt to sketch the "SOS" blinking LEDs included in the Beginners Kit. I have READ all I can find on this error tried EVERYTHING to correct the error to no avail. Is it bad hardware/wiring? I swear I have followed the program example which says it is from the Beginner Kit instruction book but I can not shake this error! HELP!
Post. Your. Code.
RJMaestro:
Is it bad hardware/wiring?
No, it's a compiler error so it's plain bad code. So where is your code? We can't check it if you don't post it (and please use code tags!).
Is it bad hardware/wiring?
Bad hardware or wiring won't be detectable until you get some code to compile and upload.
Whatever your problem is will have to wait until the psychic that we hired starts. He's scheduled to start on the 12th of never.
If you need help before then, WHERE THE HELL IS YOUR CODE?
hello: sorry for this question but I am totally confused.
I can no ## to post code between the brackets. Button (11 from the left) is for "Insert Link")
(deleted)
when </> is clicked on I get the bracketed code box in the remarks box but I have no way to insert my code. I cannot see any ## button above the icons to insert my code.(?) I am confused
(deleted)
Thank you. I am determined to learn this.
Hello: Here is my faulty code. The highlighted error line number is 24.
1
2
3
4
5 int carRed = 12;
6 int carYellow = 11;
7 int carGreen = 10;
8 int button = 9;
9 int pedRed = 8;
10 int pedGreen = 7;
11 int crossTime = 5000;
12 unsigned long changeTime;
13
14 void setup() {
15 pinMode(carRed, OUTPUT);
16 pinMode(carYellow, OUTPUT);
17 pinMode(carGreen, OUTPUT);
18 pinMode(pedRed, OUTPUT);
19 pinMode(pedGreen, OUTPUT);
20 pinMode(button, INPUT);
21 digitalWrite(carGreen, HIGH);
22 digitalWrite(pedRed, HIGH);
23 }
24
25 void loop(){
26 int state = digitalRead(button);
27
28 if(state == HIGH && (millis() - changeTime)> 5000){
29
30 changeLights();
31 }
32 }
33
34 void changeLights(){
35 digitalWrite(carGreen, LOW);
36 digitalWrite(carYellow, HIGH);
37 delay(2000);
38
39 digitalWrite(carYellow, LOW);
40 digitalWrite(carRed, HIGH);
41 delay(1000);
42
43 digitalWrite(pedRed, LOW);
44 digitalWrite(pedGREEN, HIGH);
45
46 delay(crossTime);
47
48 //flash the ped green
49 for(int x=0; x<10; x++) {
50 digitalWrite(pedGreen, HIGH);
51 delay(250);
52 digitalWrite(pedGreen, LOW);
53 delay(250);
54 }
55
56 digitalWrite(pedRed, HIGH);
57 delay(500);
58
59 digitalWrite(carRed, LOW);
60 digitalWrite(carYellow, HIGH);
61 delay(1000);
62 digitalWrite(carYellow, LOW);
63 digitalWrite(carGreen, HIGH);
64
65 changeTime = millis();
66
67}
[
I copied the code verbatim from on line instructions. This is a sketch from the beginners kit.
(deleted)
And stop opening up new threads on the same topic.
Three threads merged.
(deleted)
thank you :
I still have the error highlighted on line 24 ( sorry line numbers did not copy to forum).
Did you read reply #14?
Yes I corrected that line of code. I removed the line numbers. I still have bad code.
I still have bad code.
Which we can't see.
(deleted)
Thanks Spycatcher2. I am trying to deal with the 1,000 posting rules!
My code still does not work?
RJMaestro:
Thanks Spycatcher2. I am trying to deal with the 1,000 posting rules!
My code still does not work?
What code? The stuff you posted with line numbers? The corrected stuff posted by spycatcher? When you say it "doesn't work", do you mean that you still get compilation errors? That you couldn't upload it? Or do you mean that it compiled and uploaded, but your arduino didn't do what you expected?
Post the code that "doesn't work", and tell us in what respect it "doesn't work". In particular, don't just tell us there's an error at line 24, tell us what the error is. The compiler gives you a message - those messages are important.
Oh, and read the sticky posts at the top of the forum.