View Single Post
  #1   Spotlight this post!  
Unread 19-01-2009, 15:16
sircedric4's Avatar
sircedric4 sircedric4 is offline
Registered User
AKA: Darren
no team (The SS Prometheus)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Lousiana
Posts: 245
sircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond repute
Angry Potentiometer on cRIO, Programming in Windriver

I am having a problem getting my program to compile because I apparantly do not know the magic hieroglyphs to call the method/function whatever I want from the WPI library. I am a very old school programmer and this object oriented stuff just hurts my head. (I had just got decent enough to program in the old C environment before they threw everything away. I am a mentor so I have to try and understand this stuff before I can help the students)

I want to hook a 10 turn pot to Analog Channel 1 on the Analog Breakout board and then get the value of this pot from my C code. I have set up a new control called TurretPosition, such that:

TurretPosition = new AnalogChannel(1)

Now I want to set a float variable TurretPosDumb equal to the value of the pot. (in the old code it would have been from 0-255, but now I understand it to be -1 to 1) I have tried:

float TurretPosDumb;

TurretPosDumb = TurretPosition->GetVoltage;
TurretPosDumb = TurretPosition.GetVoltage;

and various other scenarios but I keep getting compile errors. I am a native Visual basic programmer and I do not know how to get the magic C symbol to do what I want. (All these ;, ->, . , {} and stuff just seem arbitrary) I have not had C classes, and I am learning by translation from the programming I know and looking at examples in the default codes. They thankfully gave me an example for all my Digital Inputs but I can't find an example for Analog on the cRIO side. (I figured out how to use pots on the Driver Station)

Could someone please give me an example of how to get the value of my pot from the robot. Thank you. (Bare with us old fogeys that are used to just programming in a straight line and having stuff work)
Reply With Quote