I have a line that wont compile in the following small section of code. Ive read about the interrupts in many places but this simple problem has me puzzled. This is just a snippet of code.
/attachInterrupt(pbIn,TOGGLE,CHANGE;//WHY WILL THIS NOT COMPILE?/
int pbIn= 1;
int za = 0;
int zb = 0;
int zc = 0;
int zd = 0;
const int pinread = A0;
int voltage = 0;
int count = 1;
int bump = 0;
int totalstrikes = 0;
int maxcount = 1022;
int avg = 0;
int a = 0;
void setup()
{
interrupts();
/attachInterrupt(pbIn,TOGGLE,CHANGE;//WHY WILL THIS NOT COMPILE?/
Serial.begin(9600);
}
void loop()
{
noInterrupts();
voltage = analogRead(A0);
voltage = analogRead(A0);
voltage = analogRead( A0 );
detachInterrupt() // Lets load the arrays, we have fourof them
if ((voltage >100) && (voltage <256) && (count <= maxcount))
Please use code tags.
Read this before posting a programming question
Please edit your post, select the code, and put it between [code] ... [/code] tags.
You can do that by hitting the "Code" icon above the posting area. It is the first icon, with the symbol: </>
attachInterrupt(pbIn,TOGGLE,CHANGE;//WHY WILL THIS NOT COMPILE?
No closing bracket, for one thing.
You've decided to red-rag us, haven't you? In another thread (array - Programming Questions - Arduino Forum) you were asked numerous times to use code tags, which you ignored. You also haven't read How to use this forum which asks you to use a meaningful subject line. "Lost Help Please" is not that.
TOGGLE is not the name of an ISR.
What is. I thought it couldbe any name.
stx38834:
This is just a snippet of code.
And this is where it belongs: http://snippets-r-us.com/
stx38834:
I have a line that wont compile in the following small section of code. Ive read about the interrupts in many places but this simple problem has me puzzled. This is just a snippet of code.
/attachInterrupt(pbIn,TOGGLE,CHANGE;//WHY WILL THIS NOT COMPILE?/
stx, I just wrote an unpleasant reply to you, which I have deleted solely because you claim to have been doing robotics since I was 4.
The short answer to your question is "it won't compile because it makes no sense syntactically". Surely you get that compilers don't understand your code - they mechanically process it as a series of characters.
What you appear to have done in this line is
1 - you have copy/pasted into a comment delimiter. That is, there was a '//', and you have jammed code into the middle of the two slashes. This produces nonsense, like "Jack and up the hill to fetch a Jill pail of water."
2 - you have lost a closing parenthesis.
The most casual inspection of this line of code would have told you what was wrong with it. Did you even look at it before posting it here? Have you considered wearing your glasses when you code? Or perhaps setting your IDE to use a larger font?
And you still, still, haven't gotten the message about using
** **[code]code goes here[/code]** **
tags. Again, the most cursory inspection of other people's posts on this board would have indicated to you that there is something missing with respect to your own posts.
You have to at least look like you are trying, man.
PaulMurrayCbr:
the most cursory inspection of other people's posts on this board would have indicated to you that there is something missing with respect to your own posts.
Compare this:
int pbIn= 1;
int za = 0;
int zb = 0;
int zc = 0;
int zd = 0;
const int pinread = A0;
..... to this:
int pbIn= 1;
int za = 0;
int zb = 0;
int zc = 0;
int zd = 0;
const int pinread = A0;
All you have to do is select the code and hit the </> icon above the
smiley top-left.