Use the digistump for servo control.
Planned to connect to my desk lamp but I didn't finsh this one yet.
This commit is contained in:
24
src/main.cpp
Normal file
24
src/main.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <SimpleServo.h>
|
||||
|
||||
SimpleServo servo1;
|
||||
|
||||
void setup() {
|
||||
servo1.attach(1); // !! This cost me hours, because I thought it's 6, but that's the physical pin..
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
||||
for(int posDegrees = 0; posDegrees <= 180; posDegrees++) {
|
||||
servo1.write(posDegrees);
|
||||
Serial.println(posDegrees);
|
||||
delay(20);
|
||||
}
|
||||
|
||||
for(int posDegrees = 180; posDegrees >= 0; posDegrees--) {
|
||||
servo1.write(posDegrees);
|
||||
Serial.println(posDegrees);
|
||||
delay(20);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user