|
Re: C coding
Welcome to programming! I just learned how to program a few months ago, and I'm pretty good now. If you're anything like me, then you learn by a hands on example. To get started, download the robot code off of ifirobotics.com; while at IFI, download the IFI_Loader. Next you'll need MPLAB with the C18 compiler. The main program you'll program with is User_Routines.c Just look at the code and try to figure out how it works. pwm?? are the PWM outputs on the controller. 127 is center/off. Relays are H bridges, so fwd triggers one relay, and rev triggers the other relay. If you have both on or both off, whatever you are controlling will remain off. You must have a 1 and 0 or a 0 and 1 to turn something on. In robotics, you will usually leave rev at 0 and then turn fwd on and off because of the polarity of the devices. Controls are pretty simple too, it's all in user_routines.c Good luck with programming and feel free to contact me.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian
Previous mentor and student from Team Fusion, FRC 364
|