The hello world of hardware is blinking an LED. In johnny-five, that equates to:
// Blink an LED
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
var led = new five.Led(13);
led.blink();
});
Instead of boiling the ocean implementing every API, I should start with an analogous main.c and reverse-implement the supporting libraries. Besides being pragmatic, it allows me to focus on the devexp of the end user without dwelling on the implementation details. My first take:
#include "micro-five.h"
int main()
{
Micro-Five five;
Board board;
Board_Init(&five, &board); //feels clunky
while(1) {
//todo event handler, LED init, LED blink
}
return 0; // never reached
}
The hello world of hardware is blinking an LED. In johnny-five, that equates to:
Instead of boiling the ocean implementing every API, I should start with an analogous
main.c
and reverse-implement the supporting libraries. Besides being pragmatic, it allows me to focus on the devexp of the end user without dwelling on the implementation details. My first take: