Cduino: Arduino/ATMega Programming with C and Make

Why Cduino?

Mechanical Drawing

Download

Manual

API and Sources

Lessons

Mailing List

Contributing

Quick Start

First, set up the prerequisite hardward and software. Then unpack the distribution and try the following from the top level directory:

make -rR -C blink writeflash

If the make command fails, be sure to read the hints just above the failure message...

Now your Arduino's LED should be blinking.

Talking to the Arduino over the serial port takes only two function calls from the term_io module:

make -rR -C term_io writeflash
# Wait a few seconds for the AVR to finish rebooting...
make -rR -C term_io run_screen
# Maybe hit return a few times

Abstract

This package contains:

  • a Makefile setup for programming an Arduino (or other Atmel ATMega chip) using unix command line tools
  • a library of simple modules to do various interesting things with an ATMega (blink a LED, talk over a serial line, drive simple LCD display, etc.)
In other words, it's a lot like the excellent Arduino project and uses the same open hardware, but avoids the wiring language, C++ intermediate layer, and Java-based IDE. It gives more precise specification and control of what's going on. Crusy old (and young) Unix/C programmers rejoice!

Features

News

  • Modules providing logging from a 1-wire master (one_wire_master_logger.h) to a listening slave (one_wire_slave_logger.h). Useful for getting messages out of an Arduino or ATMega at the far end of a 1-wire line, with the remote initiating communication.
  • Additions to dio.h to allow control of pin change interrupts in a pin-generic and modal fashion.
  • New software implementation of Maxsim one-wire slave protocol: one_wire_slave.h . Actually Maxim doesn't publish this, so I reverse-engineer :) Now you can make your own slaves using Arduinos (or naked ATMega chips clocked at 10 MHz or more).
  • Support for using multiple AVRISPmkII programmers simultaneously. See the definition of AVRISPMKII_PORT in generic.mk in the top-level project directory.
  • New modules for using timer1 as a simple stopwatch. Timer1 is a 16 bit timer, so there is no need to use interrupts in any way to measure shortish chunks of time. xlinked_source_html/timer1_stopwatch.h
  • New software implementation of Maxsim one-wire master protocol: one_wire_master.h .
  • New build system support for creating a random 64 bit device ID and loading it into the AVR EEPROM. See the new_random_id target in generic.mk in the top-level project directory and the random_id_test.c . test program.
  • Numerous improvements and fixes to wireless_xbee.h , including SLEEP_RQ and RESET support.
  • New module for ST Microelectronics LIS331HH accelerometer (and sibling devices): accelerometer.h.
  • New module for Maxstream XBee Series 1 wireless modules: wireless_xbee.h .
  • New module for DC motor control use the Arduino Motor Shield: dc_motor.h.
  • New module for SD card control via SPI: sd_card.h.
  • New module for SPI bus (hardware master-mode only): spi.h.
  • New tupple macros for cleaner encapsulation of IO pin choices in dio.h.
  • New module for using Timer/Counter0 hardware as an interrupt-driven stopwatch: timer0_stopwatch.h.
  • Fixed port device and baud rate autodetction to work with linux kernel 2.6 behavior. Unfortunately this means that autodetection doesn't work with earlier kernels anymore. But it's easy to set the values directly if necessary.
  • Works with Aruino Uno now, hopefully. We try to magically guesses avrdude port and baud rate requirements for Uno vs. Duemilanove Arduinos now (so should work with both).
  • New module for the DFRobot DFR0009 LCD and Keypad shield: lcd_keypad.h .
  • Browsable API and source documentation.
  • New module for HD44780 compatible LCDs: lcd.h .
  • New module for simplified digital IO pin initialization and control: dio.h .
  • Support for building C++ sources. This project is still all in C, but if anyone wants to use it with C++ it should be easier. This also make it a lot easier to borrow code from the Arduino libraries :)

Bugs and Feature Requests

Please send these to the mailing list.

Good luck!