// ************************************************************************************************
//
// Documentation for this, and the rest of the LC libraries that make this up.
// Here's the book : https://github.com/leftCoast/LC_libraryDocs/blob/main/LC_libraries.pdf
// Search for : serialStr
//
// ************************************************************************************************
#include <serialStr.h>
serialStr ourReader; // Reads complete c strings from serial.
int myNumber;
char* msg = "Please Enter Your Number:";
char* msg2 = "Your Number is: ";
void setup() {
Serial.begin(9600);
Serial.println(msg);
ourReader.setCallback(gotStr);
}
// Callback function. Reads c strings from serial port and they show up here.
void gotStr(const char* inStr) {
myNumber = atoi(inStr); // Decode the string as an int.
Serial.print(msg2); // Tell Mrs user.
Serial.println(myNumber);
Serial.println(msg);
}
// Your standard loop() function. idle() runs all the magic behind the scenes.
void loop() { idle(); }