[mw_shl_code=c,true] switch(t)
{
//控制最大油门
case KEY_UP:
{
pwmval=190;
LED0_PWM_VAL=pwmval;
LCD_ShowxNum(124,150,pwmval,3,16,0);
} break;
//控制油门加
case KEY_LEFT:
{
pwmval= pwmval+5;
if (pwmval>190) pwmval=0;
LED0_PWM_VAL=pwmval;
LCD_ShowxNum(124,150,pwmval,3,16,0);
} break;
//控制最小油门
case KEY_DOWN:
{
pwmval=110;
LED0_PWM_VAL=pwmval;
LCD_ShowxNum(124,150,pwmval,3,16,0);
} break;
//控制油门减
case KEY_RIGHT:
{
pwmval=pwmval-1;
LED0_PWM_VAL=pwmval;
LCD_ShowxNum(124,150,pwmval,3,16,0);
} break;
}[/mw_shl_code]
如上代码基于战舰V2开发板PWM例程,PWM为周期为2ms的波形,占空比为55%--95%(1.1ms--1.9ms)
控制的电调为好赢天行者40A电调,电机为朗宇系列无刷电机
通过板载的上下左右按键可以控制油门量程,亦可对电调进行编程
电调资料:http://wenku.baidu.com/link?url=kR_SNTzebL3M4TpNy962zLkL_vqN1NmVNDZvkQivgvKJ3DN8RhuYaERQQg376klli251XvM8nvODFbWM1xN_dqspAedJoPXyYe9Uez6iUZO
蓝牙APP:http://openedv.com/posts/list/12486.htm 见资料
|