It's not the installing that matters, it's writing your first program and making it do something on your board. The Arduino environment targets particular boards, and there's a repository of example programs supplied so you run them and they just work. No hunting for the right header files or the right compile options, or reading random blogs looking for examples.
I'm not really confident enough about that - I've got things working, but am not knowledgeable of the details to write a manual about them.
I've run into a few painful things too. For example, the IDE isn't really designed to cope with more than one source file. Ditching the IDE turns out to be nontrivial - I found a Makefile on the web, and eventually got it to compile (library issues). But the binary I have is different from the one output from the IDE, and my binary sits there doing nothing. Even for a trivial LED blink program.
OK, here's my fading LED mux example. Complicated by the fact that I'm using HSV rather than RGB to set the colour so I have to convert between the two. I have a string of 7 tri-colour LEDs with each LED with individual colour control. There are three common cathodes for each colour and one anode per LED, as I needed to minimise the wiring (10 pins). I'm using the Arduino PWM to set the dimming of the cathodes, and then muxing the anodes using a routine driven by an interrupt. I'm using a third-party timer library to get timer interrupts on the Due (not sure the standard library does this yet) and a third-party PWM library because the default PWM frequency is 1KHz which beats with my interrupt rate and makes the LEDs flicker. In the standard library you set the PWM duty cycle of a pin with something like analogWrite(pin, duty=0 to 255)
I've substantially refactored the code since and merged with a bigger project, this is my previous version. The motivation is that the LED fading now happens entirely under interrupts - the foreground task is oblivious they're happening. This was about three more lines of code.
So you know where to start, setup() and loop() are the two entry points in an Arduino sketch.
Theo
#include // third party timer library #include "pwm01.h"
volatile void ledSwitch();
#define LEDS 7 // run system PWM at 20KHz #define PWMFREQ1 20000
typedef struct { int r; int g; int b; } Colour;
Colour ledColour[LEDS];
// pin numbering int anode[LEDS] = {12, 5, 4, 3, 2, 10, 11}; int blueCathode = 7; int greenCathode = 9; int redCathode = 8;
int currentLED=0;
// the setup routine runs once when you press reset: void setup() { // set up LEDs - all off for (int i=0; i