|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Gyro + accelometer C++ Programing
this year we are finally going to use the gyro and accelometer, both of them are hocked up right but neither of them are working.
the gyro is hooked up to crio module 1 slot 1 and the accelometer is hooked up to the I2C port. we tried to program them but neither are working anyone got some example code p.s. sorry if there is another post about this i running late for a meeting and needed to post it quickly before i forgot |
|
#2
|
|||
|
|||
|
Re: Gyro + accelometer C++ Programing
Could you please post the source code you are trying?
|
|
#3
|
|||
|
|||
|
Re: Gyro + accelometer C++ Programing
I don't have the computer now but for the gyro we did
Code:
gyro.reset
gyro.get angle()
|
|
#4
|
|||
|
|||
|
Re: Gyro + accelometer C++ Programing
Quote:
Code:
gyro.Reset(); gyro.GetAngle(); |
|
#5
|
|||
|
|||
|
Re: Gyro + accelometer C++ Programing
Like I said I dont have the computer...
|
|
#6
|
|||||
|
|||||
|
Re: Gyro + accelometer C++ Programing
Only call Reset() when you want to reset the gyro to its initial state. If you do it every time you try to read GetAngle(), you will always read zero.
|
|
#7
|
|||
|
|||
|
Re: Gyro + accelometer C++ Programing
Thanks ala
Will it automatically show up on the driver station (the compus thingie) |
|
#8
|
|||
|
|||
|
Re: Gyro + accelometer C++ Programing
That's the dashboard, and no it won't. Take a look at the example project DashboardDataExample.
|
|
#9
|
|||
|
|||
|
Re: Gyro + accelometer C++ Programing
what about the accelometer we have it pluged into the I2C Port in our programing i think we did something like this
Code:
acc.(I2C); |
|
#10
|
|||
|
|||
|
Re: Gyro + accelometer C++ Programing
Quote:
You are initializing these objects too correct? Please post full source code when you can, it will be much easier for us to help you. |
|
#11
|
|||
|
|||
|
Re: Gyro + accelometer C++ Programing
tommarow around 4 central time i will post my code here
|
|
#12
|
|||
|
|||
|
Re: Gyro + accelometer C++ Programing
Quote:
Code:
DriverStationLCD *display = DriverStationLCD::GetInstance(); char text[255]; sprintf(text, "Gyro Value: %f", gyro.GetAngle()); display->Clear(); display->PrintfLine(DriverStationLCD::kUser_Line1, text); display->UpdateLCD(); |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|