Anyone have an original version of this file that is posted on Jameco's DIY page? I copied the file and ran it through compiler and no go! Getting so many errors messages, from thread # errors to function-main to undefined reference setup and undefined reference loop. Had thread errors starting from 370 something, that was my fault, got past them all the way up to 483, still cant get compiled, been over and over it looking for error, nothing yet, friend says code is flawed,not looping back, he has not even loaded into computer, just looked at my copy of file on paper, file is duplicate of net post, poster says it is copied from original post and pasted.
to function-main
An Arduino sketch doesn't have a "main" function.
Instead of the stream-of-conciousness post, why don't you show us what the problem is?
good idea on showing, I will work on that later, as far as function- main, that was abbreviated and that is only one of the errors. Got to get past the thread #'s first! I spent 2 days going over this already and I am working with a friend that will help with this tomorrow, but for now I have to go wash dinners dishes, and if the replies would slow down, I would leave the computer and go do dishes then get some sleep so I can thing more clearly later and answer question and make sense. If you are good at writing AVR go look at the code posted at Jameco's web page and see if it makes sense, like I said, I get error messages from threads to loop malfunctions, each time I try to write the sketch something else crashes so it would not seem to me to help by showing since it changes every time, reread my original post and notice where I indicated that the first thread was 300 something and the last time I wrote the file it went all the way up to 483 and then locked up! That would be lots of showing! Back to function main, it is core ----can't make sense out of it because each time error is something else! To get something wrong a couple of times with file this large is easy, but this is rediculous. Find the file and run it to see if it works just so you can tell me I made a mistake, I would feel lots better knowing I was stupid or blind! That's better than someone else telling me it works, but it doesn't after spending days trying to figure out why! If it doesn't work for you I would feel smarter!
Maybe lay-off the double espressos and calm down a bit.
Paragraph breaks - yeah, I like those too.
So many words...so little information!
Ha!
For anyone following this (and I'm not sure I am), this
/*
* Police Light Flasher using two arrays of red and blue LEDs.
*/
#define RRED 7 // Red LEDs on the remote module
#define RBLUE 8 // Blue LEDs on the remote module
#define LRED 2 // Red LEDs on the base module
#define LBLUE 4 // Blue LEDs on the base module
int button = 12; // button is connected to pin 12
int val; // variable for reading the button status
int state; // variable to hold the last button state
int presses = 0; // how many times the button was pressed
int mode = 0; // what mode the flasher is in
void setup(){
pinMode(RRED,OUTPUT); //sets Red LEDs as output
pinMode(RBLUE,OUTPUT); //sets Blue LEDs as output
pinMode(LRED,OUTPUT); //sets Red LEDs as output
pinMode(LBLUE,OUTPUT); //sets Blue LEDs as output
pinMode(button,INPUT); //sets the button as an input
state = digitalRead(button); //reads buttons start position
}
void loop(){
val = digitalRead(button); //sets val to the state of the button press
delay(10); //debounce multiple button presses
if (val != state){ //compares button press to current state
if (val == LOW){
if (mode == 0){ //if mode is zero and button was pressed, set mode to 1
mode = 1;
}
else {
if (mode == 1) { //increment mode to 2
mode = 2;
}
else {
if (mode == 2){
mode = 0;
}
}
}
}
state = val;
}
if (mode == 0){ //ALL OFF //mode 0 turns all LEDs off
digitalWrite(RRED,LOW);
digitalWrite(LRED,LOW);
digitalWrite(RBLUE,LOW);
digitalWrite(LBLUE,LOW);
}
if (mode == 1){ // strobe both sides, alternating color
byte count = 0; //sets a counter for flashing
byte number = 0;
while (count < 5){ //counter loop to flash red LEDs 5 times
digitalWrite(RRED,HIGH);
digitalWrite(LRED,HIGH);
delay(60);
digitalWrite(RRED,LOW);
digitalWrite(LRED,LOW);
delay(60);
count++;
}
while (number < 5){ //counter loop to flash blue LEDs 5 times
digitalWrite(RBLUE,HIGH);
digitalWrite(LBLUE,HIGH);
delay(60);
digitalWrite(RBLUE,LOW);
digitalWrite(LBLUE,LOW);
delay(60);
number++;
}
}
if (mode == 2){ // red flasher, alternating sides
digitalWrite(RRED,HIGH); //remote red on
delay(400); //wait 400 ms
digitalWrite(RRED,LOW); //remote red off
digitalWrite(LRED,HIGH); //base red on
delay(400); //wait 400 ms
digitalWrite(LRED,LOW); //base red off
}
}
/*
* Police Light Flasher using two arrays of red and blue LEDs.
*/
#define RRED 7 // Red LEDs on the remote module
#define RBLUE 8 // Blue LEDs on the remote module
#define LRED 2 // Red LEDs on the base module
#define LBLUE 4 // Blue LEDs on the base module
int button = 12; // button is connected to pin 12
int val; // variable for reading the button status
int state; // variable to hold the last button state
int presses = 0; // how many times the button was pressed
int mode = 0; // what mode the flasher is in
void setup(){
pinMode(RRED,OUTPUT); //sets Red LEDs as output
pinMode(RBLUE,OUTPUT); //sets Blue LEDs as output
pinMode(LRED,OUTPUT); //sets Red LEDs as output
pinMode(LBLUE,OUTPUT); //sets Blue LEDs as output
pinMode(button,INPUT); //sets the button as an input
state = digitalRead(button); //reads buttons start position
}
void loop(){
val = digitalRead(button); //sets val to the state of the button press
delay(10); //debounce multiple button presses
if (val != state){ //compares button press to current state
if (val == LOW){
if (mode == 0){ //if mode is zero and button was pressed, set mode to 1
mode = 1;
}
else {
if (mode == 1) { //increment mode to 2
mode = 2;
}
else {
if (mode == 2){
mode = 0;
}
}
}
}
state = val;
}
if (mode == 0){ //ALL OFF //mode 0 turns all LEDs off
digitalWrite(RRED,LOW);
digitalWrite(LRED,LOW);
digitalWrite(RBLUE,LOW);
digitalWrite(LBLUE,LOW);
}
if (mode == 1){ // strobe both sides, alternating color
byte count = 0; //sets a counter for flashing
byte number = 0;
while (count < 5){ //counter loop to flash red LEDs 5 times
digitalWrite(RRED,HIGH);
digitalWrite(LRED,HIGH);
delay(60);
digitalWrite(RRED,LOW);
digitalWrite(LRED,LOW);
delay(60);
count++;
}
while (number < 5){ //counter loop to flash blue LEDs 5 times
digitalWrite(RBLUE,HIGH);
digitalWrite(LBLUE,HIGH);
delay(60);
digitalWrite(RBLUE,LOW);
digitalWrite(LBLUE,LOW);
delay(60);
number++;
}
}
if (mode == 2){ // red flasher, alternating sides
digitalWrite(RRED,HIGH); //remote red on
delay(400); //wait 400 ms
digitalWrite(RRED,LOW); //remote red off
digitalWrite(LRED,HIGH); //base red on
delay(400); //wait 400 ms
digitalWrite(LRED,LOW); //base red off
}
}
from here:
http://www.jameco.com/Jameco/PressRoom/policeflasher.html
compiles perfectly. (I did reformat it before posting).
Now, what was the problem?