|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Direct Control of PWMs and OI in WPILib
I have been reading over the WPILib and I am really excited about it but I still want to be able to perform advanced operations.
When I wrote some code using the ifi_aliases, like pwm01 or p1_y I, I can not compile it. I realize why these don't work because they are not defined anywhere but what I want to do is directly access the values of the OI inputs and the pwm ports when using WPILib. Is there any way for me to be able to do this? Thank You, |
|
#2
|
||||
|
||||
|
Re: Direct Control of PWMs and OI in WPILib
This should help you out.
X = GetOIAInput(A,B); X is the variable name you want assign you items too. A is the OI port 1 through 4 B is the Axis on the joystick 1 = X-Axis 2 = Y-Axis 3 = Wheel 4 = Aux Port Then to drive the motor. SetPWM (C,D); C is the PWM port number 1 - 12 D is the Value or Variable to be used to drive the motor. Example of them working together to make a tank drive setup. Joy1 = GetOIAInput(1,1); Joy2 = GetOIAInput(2,1); SetPWM (1,Joy1); SetPWM (2,Joy2); |
|
#3
|
|||
|
|||
|
Re: Direct Control of PWMs and OI in WPILib
Quote:
It turns out that we are doing exactly that on the Team 190 robot - most of those functions you might replace with a single assignment statement are there for EasyC and correspond to blocks in the palette. If you are hand writing code, feel free to access those registers and IFI data structures directly. |
|
#4
|
|||
|
|||
|
Re: Direct Control of PWMs and OI in WPILib
so all you would need to do is include the various libraries and you could use commands you would normally do w/out WPIlib intertwined with the WPIlib comands? i mean it makes sence but i am just chekcing if there is anything else that i would need to include
thanks |
|
#5
|
|||
|
|||
|
Re: Direct Control of PWMs and OI in WPILib
Quote:
So you can do these things:
|
|
#6
|
|||
|
|||
|
Re: Direct Control of PWMs and OI in WPILib
Quote:
I've just started playing with WPILib (and I love it!!!) but I was hoping to use the dashboard program I've written which utilizes the six user bytes. Are these accessable via WPILib??? Steve |
|
#7
|
|||
|
|||
|
Re: Direct Control of PWMs and OI in WPILib
Quote:
There is nothing explicitly done to support or preclude setting those values. I think you can just include ifi_aliases.h and write to those bytes. When the code does the get_data/put_data I think they will get sent over. If you happen to try it first, please post a message with your results. |
|
#8
|
|||
|
|||
|
Re: Direct Control of PWMs and OI in WPILib
Quote:
So, have fun with it. I think I need to try writing a custom viewer. Would be nice for debugging. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|