|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Vex Programming
well, I got my programming kit and i had a little fun turning on leds. i've been working on controlling them with a joystick on the remote using the hardware pwm available on the first four motor connectors. and i've just ordered a couple of sharp gp2d12 ir distance sensors so maybe i can get it to stop before it runs into the cat.
i was wondering if anyone else has been doing any coding for the vex. anyone have any observations, questions, secrets to share? the sample code at vexlabs seems to be pretty clear. i've managed to dope out where most everything connects from the header files and have made a little table which can be seen at theEntropyWorks.com. motors 1-4 as i mentioned are connected to 4 of the 5 hardware pwm modules on the 18f8520 in case anyone wants to try to control a real dc motor through an h-bridge. the vex motors run at a very low frequency with a period of 18ms and a duty cycle of 1-2ms, like hobby servos. this is too slow for the hardware pwm. better hit send, here, before my session times out and i have to type everything over, again. |
|
#2
|
|||||
|
|||||
|
Re: Vex Programming
I finally got a little time to play a bit. I added some code in the default routine to limit the ramping of a motor command in response to the joystick, sort of a soft start. I'm really new at this, just dabbling to get used to the language and the environment.
I'm guessing the PWM frequency, being so low, probably helps cut stiction in startup, possibly helpful for smooth starts. |
|
#3
|
||||
|
||||
|
Re: Vex Programming
I have written a position control PID function using a pot for feedback. It models almost exactly what we will be using in FRC. Currently I am modifying the function to work with as many axis's as needed without having to duplicate the section of code for each axis. Just pass the arguments to it for each PWM you want to control. I've included a flag to indicate when the damping feature kicks in, more to prove it works than anything else.
|
|
#4
|
|||
|
|||
|
Re: Vex Programming
here's the code for my Mobile Remote Controlled Light Dimmer, project MoReCoLD. does nothing useful, but got me up to speed on hardware pwm on the pic. when my gp2d12's come in i figure i can use this for a visual indicator of what the sensors are seeing.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to build a VEX programming module | bblack7489 | FIRST Tech Challenge | 78 | 09-06-2011 16:03 |
| VEX programming | Gene F | Programming | 14 | 08-08-2006 22:21 |
| Programming for Vex robots | Jeff K. | Programming | 4 | 13-11-2005 16:40 |
| Vex bot programming Q's | BaldwinNYRookie | Programming | 6 | 09-10-2005 17:45 |
| White Paper Discuss: VEX / intelitek easyC programming document | dez250 | Extra Discussion | 3 | 15-09-2005 15:20 |