Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A collection of C inline functions and macros for programming the Arduino

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 ATmega1280
Octocat-spinner-32 ATmega8
Octocat-spinner-32 ATmegaX8
Octocat-spinner-32 ATmegaXU2
Octocat-spinner-32 ATtinyX5
Octocat-spinner-32 common
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.markdown
Octocat-spinner-32 adc.h
Octocat-spinner-32 pins.h
Octocat-spinner-32 serial.h
Octocat-spinner-32 sleep.h
Octocat-spinner-32 spi.h
Octocat-spinner-32 timer0.h
Octocat-spinner-32 timer1.h
Octocat-spinner-32 timer2.h
Octocat-spinner-32 twi.h
Octocat-spinner-32 wdt.h
README.markdown

arduino-headers

About

This is a collection of inline functions and macros I use for programming my Arduino in pure old C. It enables me to write simply

pin12_mode_input();

instead of the more cryptic

DDRB &= ~(_BV(4));

and since GCC is clever there is absolutely no overhead in doing this.

My Arduino has an ATmega328P microprocessor running at 16MHz, and unfortunately this is all the headers support right now. If somebody wants to lend me an Arduino with another chip or clock speed I'd be happy to change this.

Usage

Here is a simple C program, which just blinks the diode connected to pin 13.

#include <util/delay.h>
#include <arduino/pins.h>

int main()
{
        pin13_mode_output();

        while (1) {
                pin13_high();
                _delay_ms(100.0);
                pin13_low();
                _delay_ms(900.0);
        }

        return 0;
}

See the doorduino code for a larger example. There you can also find a Makefile for compiling and uploading Arduino programs.

License

arduino-headers is free software. It is distributed under the terms of the GNU General Public License

Contact

Please send bug reports, patches, feature requests, praise and general gossip to me, Emil Renner Berthing esmil@mailme.dk.

Something went wrong with that request. Please try again.