Arduino Basics

From arrizza.org wiki

Jump to navigation Jump to search
Previous ⇦ Hardware Basics Arduino ⇫ Up Tools and other Setup ⇨ Next

Arduino Software Development

Basics

TODO: what is an .ino file?
TODO: how does compilation work

Tools

avr-dude

TODO

avr-size

When you do a build (i.e. make) it generates a few lines at the end to tell you the size of the image:

Calculating image size
Firmware Size:  [Program: 4804 bytes (1.8%)]  [Data: 736 bytes (9.0%)] on atmega2560
EEPROM   Size:  [Program: 0 bytes (0.0%)]  [Data: 0 bytes (0.0%)] on atmega2560

You can also get similar numbers from avr-size:

$ avr-size -t ArduinoSerialInput.elf
   text	   data	    bss	    dec	    hex	filename
   4758	     46	    690	   5494	   1576	ArduinoSerialInput.elf
   4758	     46	    690	   5494	   1576	(TOTALS)

Note that 46 + 690 = 736 which is what is reported for the Data section in the build output. Also 46 + 4758 = 4804 which is what is reported for the Program section in the build output.

Software Files

setup() vs loop()

TODO: what is setup() and what is loop()

What's hidden?

TODO: where is main()?
TODO: where are the #includes?

Delays

TODO: what is delay()? What is a millisecond?

Pins & GPIO

TODO: what is pinMode?  what is OUTPUT?
TODO: how do I find out what number a pin has?
TODO: what is digitalWrite? What is HIGH and LOW?
Personal tools