Last active
November 17, 2022 02:36
-
-
Save todocono/23773ff4c4653df0ad710509fad10424 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Based on ReceiveSingleValue by Oliver Steele, 2020-2022 | |
See more at https://osteele.github.io/Arduino_SerialRecord/ | |
Arduino code | |
Programmed in class - Interaction Lab 2022Fall | |
This example code is in the public domain. | |
*/ | |
#include "SerialRecord.h" | |
#include <Servo.h> | |
SerialRecord reader(3); | |
Servo myservo; // create servo object to control a servo | |
// twelve servo objects can be created on most boards | |
int pos = 0; // variable to store the servo position | |
int led1 = 13; | |
int led2 = 11; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(led1, OUTPUT); | |
pinMode(led2, OUTPUT); | |
myservo.attach(9); // attaches the servo on pin 9 to the servo object | |
} | |
void loop() { | |
reader.read(); | |
digitalWrite(led1, reader[0]); | |
analogWrite(led2, reader[1]); | |
myservo.write(reader[2]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment