// ************************************************************************************************
//
// Documentation for this, and the rest of the LC libraies that make this up.
// Here's the book : https://github.com/leftCoast/LC_libraryDocs/blob/main/LC_libraries.pdf
// Search for : serialStr
//
// ************************************************************************************************
#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() function. idle() runs all the magic behind the scenes.
void loop() { idle(); }