Thursday, November 8, 2018

Serial monitoring for Arduino sketches

Open Arduino, then use FILE, NEW.

Select and replace that template with the following.  Colors will appear automatically.

=====================================


#include<Servo.h>
Servo HokieServo;    // My first servo is named HokieServo

void setup() {
  // put your setup code here, to run once:
HokieServo.attach(6);
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
HokieServo.write(45);
Serial.println("\t  Speed is 45 - left, medium speed");
delay(1000);
HokieServo.write(135);
Serial.println("\t  Speed is 135 - right, medium speed");
delay(1000);
}

No comments:

Post a Comment