#include <Servo.h>
#include <serialStr.h>
Servo servo;
serialStr ourReader; // Reads complete c strings from serial.
void setup() {
Serial.begin(57600);
ourReader.setCallback(doServo);
servo.attach(11);
Serial.println("Type number between 0..180 for servo movement.");
}
// Callback function. Reads c strings from serial port and they show up here.
void doServo(const char* inStr) {
float inValue;
inValue = atof(inStr);
Serial.print("moving to : ");
Serial.println(inValue);
servo.write(inValue);
}
// Your standard loop() finction. idle9) runs all the magic behind the scenes.
void loop() { idle(); }