#include <blinker.h>
#include <serialStr.h>
#define PERIOD_MS 1000
blinker aBLinker; // Auto-blinker. We'll play with it's % time on function.
serialStr comReader; // Reader of serial port and provider of complete c strings from it.
void setup() {
Serial.begin(9600); // Make serial port active.
Serial.println("Type number for new Pulse width %"); // Wake up user.
aBLinker.setPeriod(PERIOD_MS); // Set up blinking LED.
aBLinker.setPercent(50); // 50% on, 50% off as default.
aBLinker.setOnOff(true); // Make it go.
comReader.setCallback(gotCom); // When we read a string, call this function.
}
// A string cme in from the Serial port. Set pulse width with it here.
void gotCom(char* inStr) {
float percent;
percent = atof(inStr); // Convert the string to a float.
Serial.print("Setting percent to : "); // Tell user.
Serial.println(percent,2); //
aBLinker.setPercent(percent); // Set the % LED on-time.
}
// Loop, you do what you want in here. Keep the idle() call first.
// Don't use delay(). But you can use sleep(). Works the same. As
// far as you know.
void loop() { idle(); }
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
led1:A
led1:C