First off I am having a blast, I have ordered more boards sensors etc and having good success with projects and modifying sketches to do what I want them to do but I have questions.
For example in the Beginner Book there are "loop" terms like "oneAfterAnother, motorOnthenOff etc..
I am a bit lost as to where these come from, are they made up by the great minds that make the example sketches ? Is there a glossary I have not come across yet.
I basically understand digitalread,write pins and those type funtions but want to learn more, also confusing is void why was that programming word chosen.
Also come to find out that capitalization means a lot,how do you know when and where to apply
I know I am babbling a bit and asking questions that may not make sense
Loop verbage - words that make things happen ?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- mjpcarbon
- Posts: 436
- Joined: Fri Nov 29, 2013 8:57 pm
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Loop verbage - words that make things happen ?
What book are you referring to? Can you provide a link?For example in the Beginner Book there are "loop" terms like "oneAfterAnother, motorOnthenOff etc.
- mjpcarbon
- Posts: 436
- Joined: Fri Nov 29, 2013 8:57 pm
Re: Loop verbage - words that make things happen ?
Sorry I was referring to the booklet that came with the Beginner kit "Experimenters Guide"
circ-02 oneafteranothernoloop oneatatime
circ-03 motoronthenoff motoracceleration
circ-06 playnote playtone
where do these terms come from?
circ-02 oneafteranothernoloop oneatatime
circ-03 motoronthenoff motoracceleration
circ-06 playnote playtone
where do these terms come from?
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Loop verbage - words that make things happen ?
Those terms are being defined by the example code. For example, motorOnThenOff() is defined as follows:where do these terms come from?
This is a 'comment header' describing what the following lines of code do. Everything between "/*" and "*/" is a comment.
Code: Select all
/*
* motorOnThenOff() - turns motor on then off
* (notice this code is identical to the code we used for
* the blinking LED)
*/
Code: Select all
void motorOnThenOff(){
Code: Select all
int onTime = 2500; //the number of milliseconds for the motor to turn on for
int offTime = 1000; //the number of milliseconds for the motor to turn off for
digitalWrite(motorPin, HIGH); // turns the motor On
delay(onTime); // waits for onTime milliseconds
digitalWrite(motorPin, LOW); // turns the motor Off
delay(offTime); // waits for offTime milliseconds
}
- mjpcarbon
- Posts: 436
- Joined: Fri Nov 29, 2013 8:57 pm
Re: Loop verbage - words that make things happen ?
Bill in the line void motorOnThenOff what has real meaning the word motor or the OnThenOff ?
Would void motor be the same ? Is the OnThenOff really needed or more of a description of what is going to happen and does the Uppercase matter?
Would void motor be the same ? Is the OnThenOff really needed or more of a description of what is going to happen and does the Uppercase matter?
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Loop verbage - words that make things happen ?
Neither. You could call it "xyzzy" if you wanted. motorOnThemOff is just a more descriptive name for what it does. Similarly, the upper/lower case conventions have no real meaning either. You just have to be consistent. If you define it to be "sillyThing()", then you have to spell it exactly the same whenever you call it. If you try to call "sillything()" or SillyThing()" you will get a compile error.in the line void motorOnThenOff what has real meaning the word motor or the OnThenOff ?
- mjpcarbon
- Posts: 436
- Joined: Fri Nov 29, 2013 8:57 pm
Re: Loop verbage - words that make things happen ?
Perfect !
Thank you
Thank you
Please be positive and constructive with your questions and comments.