This is one of a collection of pages which, together, attempt to show you "everything" about the Arduino's programming language.
There is a page for you with more information about the project in general, and the way these pages are organized, if you want that.
Please visit my page about power browsing notes sometime.
This page, and the software it references, ©TK Boyd, 1/2010.
Here you will find not so much a tutorial as a short discussion of the compound operators provided for your use by the people who built the Arduino language. Useful, but not rocket science. An easy "tutorial", for a change.
A "compound operator" is a shorthand way of accomplishing something which can be done by other means which merely involve more typing. The "other means" can, in some places, to some readers, be more transparent than the clever things you can do with compound operators.
We have looked at one, and sort of looked at another....
bTmp++;
... is the compound operator way of doing...
bTmp=bTmp+1;
This particular compound operator ("++") is, justifiably, commonly used in "for..." statements.
You should also know, although it doesn't matter to its use in "for..." statements, that it "returns the old value", whereas....
++bTmp;
... "returns the new value".
I suspect that means if you did....
intTmp=5; Serial.println(intTmp++);
... you would get 5 in the serial monitor window, whereas
intTmp=5; Serial.println(++intTmp);
....would give you 6 in the window. In both cases, if you subsequently did....
Serial.println(intTmp);
... you would get 6.
There are some other compound operator "shortcuts" of a similar nature...
x += y; // equivalent to the expression x = x + y; x -= y; // equivalent to the expression x = x - y; x *= y; // equivalent to the expression x = x * y; x /= y; // equivalent to the expression x = x / y;
Personally, I don't find the "pedestrian" versions, shown in the "equivalent" comment in each of the above too tedious... and I like the, to me, more clear representation afforded by, say....
x=x+y;
... but you may see "x += y; in other people's code, and now you know what it means, or you may disagree and think that the shortcut is clear and worthwhile. By all means use it, if you do!
The search engine is not intelligent. It merely seeks the words you specify. It will not do anything sensible with "What does the 'could not compile' error mean?" It will just return references to pages with "what", "does", "could", "not".... etc.
SPELL your search term properly. When I review search logs, it is amazing how many people ask the engine to search for something meaningless.
Why does this site cause a script to run? I have my web-traffic monitored for me by eXTReMe tracker. They offer a free tracker. If you want to try it, check out their site. And if there are Google ads on the page, they are run with scripts, too.
Here is how you can contact this page's editor. This page, and the software it references, ©TK Boyd, 1/2010.
Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org