+Al McElmon prompted me to get my arse into gear and so:
Over the next couple of posts I'm going to do exactly that by referring to some of the chapters and code from Matt's book and providing code and schematics that should build working examples.
This first post will focus on Chapter 3. Lets kick off with a wiring diagram:
As far as the code goes, I have used the code from Chapter3 in the zip file that can be found on Matt's site
You will need to create:
- An Arduino project file (.ino for the Arduino IDE 1.0+) with the following contents:
extern "C" { #include "main.h" } void setup() { } void loop() { themain(); }
- Create the following main.h file:
#ifndef __MAIN_H #define __MAIN_H #define PB0 PINB0 #define PB1 PINB1 #define PB2 PINB2 #define PB3 PINB3 #define PB5 PINB5 #define PC0 PINC0 #define PC1 PINC1 #define PC2 PINC3 #define PD1 PIND1 #define PD3 PIND3 #define PD4 PIND4 #define PD5 PIND5 #define PD6 PIND6 #define PD7 PIND7 int themain(void); #endif
- Copy the main.c from the "/code/ch3" dir in Matt's source archive.
- Edit the main.c file to add #include "main.h" after the first two includes:
#include <stdint.h> #include <avr/io.h> #include "main.h"
- And finally rename the function "int main(void)" to "int themain(void)"
In a future post I will look into some more exciting code, re-programming the fuses on the Arduino to enable the clock output and other bits necessary in order to get Matt's full library working.
Until then, happy hacking!
-(e)
No comments:
Post a Comment