#include #include Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(); #define SERVOMIN 150 // this is the 'minimum' pulse length count (out of 4096) #define SERVOMAX 600 // this is the 'maximum' pulse length count (out of 4096) String inputString = ""; // a String to hold incoming data boolean stringComplete = false; // whether the string is complete void setup() { Serial.begin(9600); pwm.begin(); pwm.setPWMFreq(60); // Analog servos run at ~60 Hz updates delay(10); } void loop() { // print the string when a newline arrives: if (stringComplete) { Serial.println(inputString); // clear the string: inputString = ""; stringComplete = false; } } void serialEvent() { while (Serial.available()) { // get the new byte: char inChar = (char)Serial.read(); // add it to the inputString: inputString += inChar; // if the incoming character is a newline, set a flag so the main loop can // do something about it: if (inChar == '\n') { stringComplete = true; } } } void svuota(){ }