Created
December 7, 2014 08:57
-
-
Save jacobrosenthal/69093da97374ea8efc2a to your computer and use it in GitHub Desktop.
Light Blue Bean Slider Control Servo Example
This file contains hidden or 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
#define CONTROL 0 | |
int servoPin = 0; | |
void setup(){ | |
pinMode(servoPin, OUTPUT); | |
} | |
void loop(){ | |
// Get any serial input from sandbox IOS app | |
char buffer[64]; | |
size_t length = 64; | |
length = Serial.readBytes(buffer, length); | |
if ( length > 0 ) | |
{ | |
if( buffer[0] == CONTROL) | |
{ | |
analogWrite(servoPin, buffer[1]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment