Keyestudio 4WD Bluetooth Multi-functional Car Manual page 135

Hide thumbs Also See for 4WD Bluetooth Multi-functional Car:
Table of Contents

Advertisement

{
SL = digitalRead(SensorLeft);
SM = digitalRead(SensorMiddle);
SR = digitalRead(SensorRight);
}
void servopulse(int servopin,int myangle) //defining a function of pulse
{
pulsewidth=(myangle*11)+500; //converting angle into pulse width value at 500-2480
digitalWrite(servopin,HIGH); //increasing the level of motor interface to upmost
delayMicroseconds(pulsewidth); //delaying microsecond of pulse width value
digitalWrite(servopin,LOW); //decreasing the level of motor interface to the least
delay(20-pulsewidth/1000);
}
void Set_servopulse(int set_val)
{
for(int i=0;i<=10;i++) //giving motor enough time to turn to assigning point
servopulse(servopin,set_val); //invokimg pulse function
}
void M_Control_IO_config(void)
{
pinMode(pinLB,OUTPUT); // /pin 2
pinMode(pinLF,OUTPUT); // pin 4
pinMode(pinRB,OUTPUT); // pin 7
pinMode(pinRF,OUTPUT); // pin 8
pinMode(Lpwm_pin,OUTPUT); // pin 11 (PWM)
pinMode(Rpwm_pin,OUTPUT); // pin10(PWM)
keyestudio
www.keyestudio.com
133

Advertisement

Table of Contents
loading

Related Products for Keyestudio 4WD Bluetooth Multi-functional Car

Table of Contents