Quote:
|
Originally Posted by David55
if(p1_sw_trig==1)
pwm01=0;
else if(p1_sw_trig==0)
pwm01=127;
if(p1_sw_top==1)
pwm01=255;
else if(p1_sw_top==0)
pwm01=127;
This is how you would do it in mplab...not sure if it will work in easy c.
The "p1's" in the "if's" are dependent on what port your joystick is plugged into in the OI. If your joystick is plugged into port 2- change it to p2_sw_trig.
Also...the ""pwm01" should be changed to whatever pwm your motor is connected to. You should also check if the thumb button is p1_sw_top...it could also be p1_sw_aux1 or p1_sw_aux2.
Please tell me if I confused you and I will try to make it simpler.
|
I would not use '0' or '255' as PWM #s. Use '1' and '254'. two '255's in a row indicate end of packet and can cause some erratic behavior.
I havent looked at easy C but you should be able to look at the code behind each icon and edit it, thus the code above should be useable.
Good luck.