Changes

Jump to: navigation, search

Week 6 Lab

724 bytes added, 15:30, 5 May 2009
no edit summary
L293 quadruple half H-Bridge:
http://www.st.com/stonline/books/pdf/docs/1328.pdf
 
== Moving a solenoid ==
== Moving a Servo ==
<code>
// potentiometer_servo
// turning the knob turns the servo
// Robert Twomey - roberttwomey.com
== Moving #include <Servo.h> Servo myservo; // create servo object to control a servo // a solenoid maximum of eight servo objects can be created int a_in =0; // analog in pinint val =0; // variable to store analog value
int pos = 0; // variable to store the servo position
int delay_time = 15;
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
val=analogRead(a_in); // read value from potentiometer
pos=map(val, 0, 1023, 0, 180); // map 0-1023 value to 0-180 degrees
myservo.write(pos); // set servo position
delay(50);
}
</code>
== Homework ==
ASSIGNMENT:

Navigation menu