hello everyone;
normally i have a program allowing the free-scale smart car to be controlled by PC inputs but i have a persisted problem that appear after compiling .
the problem : identifier "P21" undefined "Servo myservo (P21)"
and this is my program :
- include "TFC.h"
- include "mbed.h"
- include "Servo.h"
Servo myservo(p21);
Serial pc(USBTX,USBRX); /*defining communication*/
float Speed_Pot0;
int main()
{
pc.printf("RC mode \n");
if ( TFC_PUSH_BUTTON_0_PRESSED ) {
TFC_HBRIDGE_ENABLE;
printf("Servo Calibration Controls:\n");
printf("1,2,3 - Position Servo (left, middlle ,right)\n");
printf("4,5 - increase or decrease range\n");
printf("z move forrward \n");
printf("s Move backward \n");
float range = 0.0005;
float position = 0.5;
while(1) {
switch(pc.getc()) {
case '1':
position = 0.0;
break;
case '2':
position = 0.5;
break;
case '3':
position = 1.0;
break;
case '4':
range += 0.0001;
break;
case '5':
range -= 0.0001;
break;
}
printf("position = %.1f, range = +/-%0.4f\n", position, range);
myservo.calibrate(range, 45.0);
myservo = position;
char c = pc.getc();
while (c == 'z') {
Speed_Pot0 = 0,3 ;
TFC_SetMotorPWM(Speed_Pot0,Speed_Pot0);
break;
}
while (c == 's') {
Speed_Pot0 = -0,3 ;
TFC_SetMotorPWM(Speed_Pot0,Speed_Pot0);
break;
}
}
} else {
if ( TFC_PUSH_BUTTON_1_PRESSED ) {
TFC_HBRIDGE_DISABLE;
}
}
}
/* please help meee */
hello everyone;
normally i have a program allowing the free-scale smart car to be controlled by PC inputs but i have a persisted problem that appear after compiling .
the problem : identifier "P21" undefined "Servo myservo (P21)"
and this is my program :
Servo myservo(p21); Serial pc(USBTX,USBRX); /*defining communication*/
float Speed_Pot0;
int main() { pc.printf("RC mode \n");
if ( TFC_PUSH_BUTTON_0_PRESSED ) { TFC_HBRIDGE_ENABLE; printf("Servo Calibration Controls:\n"); printf("1,2,3 - Position Servo (left, middlle ,right)\n"); printf("4,5 - increase or decrease range\n"); printf("z move forrward \n"); printf("s Move backward \n");
float range = 0.0005; float position = 0.5;
while(1) { switch(pc.getc()) { case '1': position = 0.0; break; case '2': position = 0.5; break; case '3': position = 1.0; break; case '4': range += 0.0001; break; case '5': range -= 0.0001; break; } printf("position = %.1f, range = +/-%0.4f\n", position, range); myservo.calibrate(range, 45.0); myservo = position;
char c = pc.getc();
while (c == 'z') { Speed_Pot0 = 0,3 ; TFC_SetMotorPWM(Speed_Pot0,Speed_Pot0); break; }
while (c == 's') { Speed_Pot0 = -0,3 ; TFC_SetMotorPWM(Speed_Pot0,Speed_Pot0); break; }
}
} else { if ( TFC_PUSH_BUTTON_1_PRESSED ) { TFC_HBRIDGE_DISABLE; } } }
/* please help meee */