Lab 7: lolWalk

A servo driven kitteh controlled by a potentiometer.

 

// Modification of Sweep example
// by BARRAGAN <http://barraganstudio.com> 
// This example code is in the public domain.
 
 
#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
 
int pos = 0;    // variable to store the servo position 
int pot = 4;
 
void setup() 
  myservo.attach(11);  // attaches the servo on pin 11 to the servo object
  
  Serial.begin(9600);         // connect to the serial port
  Serial.println("Servo control program ready"); 
 
 
void loop() 
{
 pos = map(analogRead(pot), 0, 1024, 0, 180);
 myservo.write(pos);
P1010183.jpg
P1010180.jpg
0
Your rating: None