void varedit_demo(void) { unsigned long LastMainLoopUpdate; u08 pwm_state; LastMainLoopUpdate = 0; #ifdef LED_CODE pwm_state = LED_PWM_State; led_pwm(PWM_ON); // enable PWM for LEDs led_set(2, 0); led_set(3, 0); // var editor will operate on LEDInten arrays directly, no code appears in loop #endif #ifdef MOTOR_CODE motor_init(); #endif ve_init(ve_sample_varlist); // init variable editor pass varlist function ref.(see: above) ve_read(0); // load variables saved in EEPROM while(ve_update()) { // ve_update called periodically to handle inputs.. if(get_time_alive_100ths() > (LastMainLoopUpdate + UpdateDelay)) { LastMainLoopUpdate = get_time_alive_100ths(); // this code executes at rate determined by UpdateDelay e.g. 5 = 20 Hz if(BeepEnable) beep(BeepDur, BeepFrq); if(PWMDirect) { #ifdef MOTOR_CODE motor_pwm('L',PWML); motor_pwm('R',PWMR); #endif } } } #ifdef LED_CODE if((pwm_state & ENABLED) == 0) { // we started with PWM off led_pwm(PWM_OFF); // so disable led PWM mode } #endif wait_while_touched(); lcd_clear(); }
//Setzt die Motorkraft für den linken und rechten Motor void setMotPow(unsigned left, unsigned right){ motor_pwm(motLeft,left); motor_pwm(motRight,right); }