SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By mgiven
#182670
Hello Genius Hive Mind,

I am new to arduino, and would greatly appreciate any insight you would have into an issue I am running into with getting a particular part of code to work.

I reprogrammed a lilytwinkle with a Tiny AVR programmer successfully, and am trying to upload the sketch below to test some Morose code (which I've used in the past on a red board), however I keep receiving errors when I include the "dash" under void loop, and "void dash". The errors are " pin was not declared in this scope" and "dash was not declared in this scope". When I only have the coding for "dot" things work just fine. Would anyone please be able to offer advice for why this might be, and if there is a way to resolve it? Thank you so much for your time. Best, mgiven

int blinkPin = 0;
void setup()
{
pinMode(blinkPin,OUTPUT);
}

void loop()
{
dot(); dash(); // letter A
delay(3000); // 3 sec b/w loops

}

void dot()
{
digitalWrite(pin,HIGH); // dot ON
delay(250); // on for.25 sec
digitalWrite(pin,LOW); //dot OFF
delay(250); // off for .25 sec
}

void dash()
{
digitalWrite(pin,HIGH); // dash ON
delay(1000); // on for 1 sec
digitalWrite(pin,LOW); // dash OFF
delay(250); // off for .25
}
#182688
Look at your calls to digitalWrite. Note the parameter "pin". Where is "pin" defined? Fix that and try compiling again.

- Chip

PS. Where is Mee_n_Mac when we need him? There have been several posts without code blocks. We need his standard reply. It seems like sacrilege for anyone else to post it.

PSS. I hope he's alright.
User avatar
By Ross Robotics
#182691
uChip wrote:PSS. I hope he's alright.
I agree. I am sure he's getting email notifications from the forum on all the posts he's posted in. So, I deduce that he doesn't have access to internet.. Hopefully he just moved to a place that's not connected, ie, helping orphans in a third world country. The only other guesses is he's not on this earth anymore or in a place that will not allow you to have access to the outside world, ie, prison.

I will just hope the best for him, and hope he returns..
#182692
codlink wrote: I am sure he's getting email notifications from the forum on all the posts he's posted in.
I never get notifications: must have never turned them on. That said, people move on. There are tons of posters I haven't seen here in years and likewise, there are forums I used to be on every day that I never visit anymore. Still hope he/she's OK though.
User avatar
By Ross Robotics
#182693
I get email notifications.. I do agree that people move on, but from I find it hard to believe that Mac would. I too have left forums for no apparent reason. Maybe an administrator and him had a fight through PMs.. Hell, we may never know..
#182701
Hi, uChip,

Thanks for your reply and help-- it hasn't yet become clear to me, exactly what I have muffed up but I'm sure I will figure it out.

I apologize if I did something wrong when it came to making a post without a "code block". I'm new to coding, arduino and your culture, and am not aware of every protocol and haven't nailed down all the jargon. I appreciate everyone's patience, as I know what it is like to specialize in a particular field where amateurs often jump-in to try something new-- my life's work is to help those people.

Thank you again for your time.
User avatar
By Ross Robotics
#182703
It's not against any "written" rule you have to use [ code] tags.. But it's just common courtesy. When using codes tags, it preserves the indentation that just makes it more readable.. If you're in the full editor, the button with the "Code" on it is the one you need. You can press that before you paste code in, or highlight the code then press that button.

The error is fussing about this line. 'pin' isn't declared, which it's not..
Code: Select all
digitalWrite(pin,HIGH); // dot ON
You have 'blinkPin' declared..
Code: Select all
int blinkPin = 0;
Also note that capitalization is seen..