Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
12 years, 2 months ago.
Servocontrol with LPC11u24 using accelerometer iusedfollowingcode
#include "mbed.h"
AnalogIn xvalue(p19);
AnalogIn yvalue(p20);
DigitalOut servoa(p25);
DigitalOut servob(p26);
int main()
{
while(1)
{servoa=1;servob=1);
wait(.0005+.00002*xvalue.read());
servoa=0;
wait(.02);
}
}
I wanted to know if the code is correct. Can you guys also tell me what would be the range of values for analog in
1 Answer
12 years, 2 months ago.
You now use DigitalOut for servos, you need PwmOut.
AnalogIn returns values between 0 and 1.