October 2019
Intermediate to advanced
350 pages
9h 5m
English
In the previous section, we verified the following:
Now, let's create an interface to control the servo from the Serial Monitor. Create a new sketch and save it as ch5_01_servo_serial.
Delete the boilerplate code that is automatically added to new sketches (the empty setup and loop functions) and replace the contents of your editor with the following code:
#include <Servo.h> Servo myservo; void setup() { Serial.begin(9600); myservo.attach(9);} void loop() { while (Serial.available() > 0) { int inputValue = Serial.parseInt(); if (inputValue == ...Read now
Unlock full access