Monday, April 21, 2014

Introducing the Trinket

Trinket is a small tiny microcontroller board, built around the Atmel ATtiny85, a little chip with a lot of power, lowest-cost arduino-IDE programmable board!

Thursday, April 17, 2014

Saturday, April 12, 2014

Example of using SimpleTimer Library for Arduino



This example show how to use the SimpleTimer Library for Arduino on Arduino Due to trigger a callback function in every 500ms, to toggle LED and send somethinf to Serial port. SimpleTimer is simple library to launch timed actions. Before you can use the library, you have to install it in your sketchbook/libraries folder, read Installation.

#include <SimpleTimer.h>

int led = 13;

SimpleTimer simpleTimer;
boolean ledon;
unsigned long lasttime;
unsigned long now;

void setup() {
    pinMode(led, OUTPUT);
    Serial.begin(9600);
    simpleTimer.setInterval(500, callback_SimpleTimer);
    lasttime = millis();
}

void loop() {
    simpleTimer.run();
}

void callback_SimpleTimer(){
    now = millis();
    digitalWrite(led, ledon = !ledon);
    Serial.println(now - lasttime);
    lasttime = now;
}