Ignition on!

Diving straight into code, you can blink a LED on your target board with a few lines of code:

// Blink the first platform LED.

#include "libplatform/platform.h"

  // Initialize platform.

  // Blink first LED forever.
  for (;;)
      platform_write_led(0, 1);     // LED on
      platform_spin_delay_ms(500);  // Wait
      platform_write_led(0, 0);     // LED off
      platform_spin_delay_ms(500);  // Wait

Hopefully, this should be self-explanatory, but here are some noteworthy items:

By the way...

This does the job, but isn't the kindest way to blink a LED. Because this example uses platform_spin_delay_ms to pause between changing the LED state, the processor is active all the time, burning cycles, waiting for the right moment to continue. There is a better way…

You can use ctl_delay, rather than platform_spin_delay_ms, to delay the user task and let other tasks run. If you do this, you are being much kinder to the tasking system, and in this case the processor is put to sleep whilst waiting.