HOME > > ARDUINO LANGUAGE COURSE  t.o.c.    Delicious Bookmark this on Delicious   Recommend to StumbleUpon

What still needs to be explained

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.

========

This page isn't tutorial in nature. It has two roles. It is my "to do" list. And it will tell you what I haven't told you!

Do you get annoyed when, say, your digital camera's manual doesn't tell you how to cause the numbers assigned to images to be expanded to more digits.... because there's no way to do that? Drives me mad. Why can't manufacturers be more considerate and forthcoming. Would it hurt them SO much to save me hunting with a little sentence saying "It isn't possible to change the number of digits assigned to an image's number." Bah. When you and I are running things....

ANYWAY.... here are the things I haven't (yet) addressed in these tutorials... I don't think. It might be worth giving the search tool a try. (It is at the bottom of the page.) Maybe I've covered something... but forgotten!

Things I haven't covered....

Given the content of the page, I hope you'll understand if I don't spend ages polishing the format to a high sheen.

If you have a burning urge to know about these things, and you have done many of my tutorials, you are ready for the official Arduino Language Reference. Be advised that comes in two versions, the Basic and the Extended. It is easy to confuse one for the other.

I've covered everything that I can imagine a beginner or intermediate Arduino user will find generally useful. Do please write and tell me if I am overlooking some Good Things that need writing up sooner rather than later.


I've failed to tell you about "break", "continue" and "goto".... except for one specific, good, use of "break".

I don't find the first two helpful... but am prepared to believe that it is just ignorance on my part.

On the other hand, "goto" is, in my opinion, just a Bad Thing and to be eschewed!


I've failed to tell you about pointer access operators. You probably would use them, if you knew how to, but, to quote from the excellent Arduino Language Reference....

"Pointers are one of the more complicated subjects for beginners in learning C, and it is possible to write the vast majority of Arduino sketches without ever encountering pointers. However for manipulating certain data structures, the use of pointers can simplify the code, and knowledge of manipulating pointers is handy to have in one's toolkit."

(end quote)


By the way- the "Arduino language", as I have tended to refer to it, is a version of the very significant language called C++, which was created by extending the older C. Do not, however, expect that every C or C++ idea works in an Arduino. There are some things that work... sometimes... but if they aren't in the official Arduino language reference guide, you are taking chances if you use them. Although, to quote the official reference guide again....

The Arduino language is based on C/C++ and supports all standard C constructs and some C++ features. It links against AVR Libc and allows the use of any of its functions; see its user manual for details.

(end second quote). A first look at the User Manual might leave you wondering what use any of it is... but once you get into it, you may be tempted to use some of the "goodies" there. Hint: From the User Guide, you need to drill down into the Library Reference, and from there into specific modules, e.g. into string.h... but if you are finding my tutorials useful, I suggest you postpone trying the more advanced stuff just yet. You CAN do an AWFUL LOT with the "basic" Arduino language elements, presented in my tutorials.)


I haven't told you about directly referencing the ports of the Atmega chips at the heart of Arduinos. The advantages become important only in esoteric situations, and the extra responsibilities and hassles for the programmer are significant.


I haven't covered the "sizeof" operator. To quote the Arduino Language Reference...

"The sizeof operator returns the number of bytes in a variable type, or the number of bytes occupied by an array."

When you need to know this, write and tell me what you want to use the "sizeof" operator for.


I haven't told you about the clever things you can do with "analogReference". Clever and dangerous things. For beginners, I would suggest you stick to the default analog reference, and only connect things to the analog pins of the Arduino which have voltages between zero and the voltage your Arduino runs at: 5 volts for most of us. It is safest to supply the source of the analog signal with it's power directly from the Arduino... but of course, you can't hook "just anything" up to the Arduino's 5v line.


Data types

Floating types

Arrays and array useage

String/Character types... link to and from the brief comment in FA1serial about "Hello World" when this tut begun.

Final roundup of stray types... and discussion of "signed"/"unsigned".


Conversions

I've introduced them, and covered int, word, long, and byte... although I may have given you bad information about byte! (It may be that byte-type data is treated as -128 to 127... I have to look into this! The Arduino reference guide says what I said... that a "byte" type variable will hold whole numbers from 0 to 255. But I saw something that suggested otherwise... maybe the thing I saw was wrong, but if it was, it was wrong in a plausible way.)

.. to do....vvvv
      * char()
      * float()
..done....vvvv
    ((* byte()  --- but errors may exist in what I said.
    ((* int()
    ((* word()
    ((* long()

What is the Ascii chart, and why do I care?

"Proper" review of: "if.. else.." in all guises

"Proper" review of: "for..."


Constants

# HIGH | LOW
# INPUT | OUTPUT
# true | false

Bitwise Operators

    * & (bitwise and) {{DONE
    * | (bitwise or)  {{DONE.. do rest...
    * ^ (bitwise xor)
    * ~ (bitwise not)
    * << (bitshift left)
    * >> (bitshift right)
.. incl...
# &= (compound bitwise and)
# |= (compound bitwise or) 

Variable Scope & Qualifiers

* variable scope
    * static
    * volatile
    * const 

Advanced I/O

    * shiftOut(dataPin, clockPin, bitOrder, value)
    * unsigned long pulseIn(pin, value)
    * analogWrite (note: It only works on some pins. Which pins
            varies with the board you are using. Sends PWM signals out.

Time

    * unsigned long millis()- touched on in lock, for re-seeding random... but needs more.
    * unsigned long micros() {BREIFLY mentioned?}
    * delayMicroseconds(us) 

Math

    * min(x, y)
    * max(x, y)
    * abs(x)
    * constrain(x, a, b)
    * map(value, fromLow, fromHigh, toLow, toHigh)
    * pow(base, exponent)
    * sqrt(x) 

Trigonometry

    * sin(rad)
    * cos(rad)
    * tan(rad) 

Bits and Bytes

    * lowByte()
    * highByte()
    * bitRead()
    * bitWrite()
    * bitSet()
    * bitClear()
    * bit() 

External Interrupts

    * attachInterrupt(interrupt, function, mode)
    * detachInterrupt(interrupt) 

Interrupts

    * interrupts()
    * noInterrupts() 

And, in Serial.... Functions

    * begin()
    * available()
    * read()
    * flush()
    * print()
    * println()
    * write() 

Additional things to address, beyond scope of mere language reference....


The optional internal pull up, and how to "connect" it....

To quote guide....

"If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup. The pullup resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinMode() function."

For that, also see: http://arduino.cc/en/Tutorial/DigitalPins


Backing store options. If you are capturing data with an Arduino, and wish to look at it later, there are many options. Design factors: Cost, complexity, reliability, easy of use, capacity.

There are devices to allow you to plug in microSD cards, other devices accept USB thumbdrives (and take care of the complexities of writing to a Windows readable file system. And there are options for using EEPROM, either the Arduino's, or external units.


Real time clocks (RTCs). If you are doing data logging, you may want to stamp events with when, in date/time of day" terms, they happened. There are RTC modules available. ( Sparkfun does one ($20))

See Maurice Ribble's answer, if you want answers now!


GOOD tuts, worthy of link, with list of topics covered...

Mike Cook's tutorials

GOOD notes on hardware ideas, worthy of link, with list of topics covered...

Mike Cook's "Workshop".. motor driving, etc.

GOOD notes on complete projects, worthy of link, with list of topics covered...

Mike Cook's "Hardware Projects"


See also, and recommend....

http://arduino.cc/en/Tutorial/Foundations

... but note they are not using the term "Foundations" as a synonym for "basics". They are using it in the sense of "foundations of buildings"... that upon which everything you do is founded.


Write up what this quote from the guide is explaining...

"The analog input pins can be used as digital pins, referred to as numbers 14 (analog input 0) to 19 (analog input 5)."


Write up "Processing", the language.... http://en.wikipedia.org/wiki/Processing_%28programming_language%29

Write up "Hyperterminal"-type connections to Arduino.

Generate notes on connecting specific external devices!! (Probably indexed from artut.htm).. especially LCDs. Discuss direct and via controller options. Also matrix keyboards and LED arrays.



But that's about it! Once you've finished the tutorials, you will know most of what there is to know about programming Arduinos. Aren't you glad you're not dealing with Windows and its gazillion DLLs, APIs, etc, etc... ever changing, to boot.




   Search this site or the web      powered by FreeFind

Site search Web search
Site Map    What's New    Search

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.


Click here to return to Arduino COURSE table of contents.
Click here to go to the author's home page.

Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.


Here is how you can contact this page's editor. This page, and the software it references, ©TK Boyd, 1/2010.

Valid HTML 4.01 Transitional Page WILL BE tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org