Go to Post Check Chief Delphi, and if there isn't a post, make one. - sithmonkey13 [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 30-01-2011, 18:10
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 495
tomy has a spectacular aura abouttomy has a spectacular aura about
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
Reply With Quote
  #2   Spotlight this post!  
Unread 30-01-2011, 19:24
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Re: Gyro + accelometer C++ Programing

Could you please post the source code you are trying?
Reply With Quote
  #3   Spotlight this post!  
Unread 30-01-2011, 19:39
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 495
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: Gyro + accelometer C++ Programing

I don't have the computer now but for the gyro we did


Code:
gyro.reset
        gyro.get angle()
Is there anything special you have to do to see it the driver station?
Reply With Quote
  #4   Spotlight this post!  
Unread 30-01-2011, 19:41
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Re: Gyro + accelometer C++ Programing

Quote:
Originally Posted by tomy View Post
I don't have the computer now but for the gyro we did


Code:
gyro.reset
        gyro.get angle()
Is there anything special you have to do to see it the driver station?
That code is incorrect,
Code:
gyro.Reset();
gyro.GetAngle();
Reply With Quote
  #5   Spotlight this post!  
Unread 30-01-2011, 19:56
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 495
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: Gyro + accelometer C++ Programing

Like I said I dont have the computer...
Reply With Quote
  #6   Spotlight this post!  
Unread 30-01-2011, 20:00
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Re: Gyro + accelometer C++ Programing

Quote:
Originally Posted by tomy View Post
Is there anything special you have to do to see it the driver station?
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();
Or if you mean the display on the Dashboard, take a look at the DashboardData sender in some of the example projects (such as Vision tracking).
Reply With Quote
  #7   Spotlight this post!  
Unread 30-01-2011, 20:02
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
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.
Reply With Quote
  #8   Spotlight this post!  
Unread 30-01-2011, 20:14
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 495
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: Gyro + accelometer C++ Programing

Thanks ala
Will it automatically show up on the driver station (the compus thingie)
Reply With Quote
  #9   Spotlight this post!  
Unread 30-01-2011, 20:21
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Re: Gyro + accelometer C++ Programing

Quote:
Originally Posted by tomy View Post
Thanks ala
Will it automatically show up on the driver station (the compus thingie)
That's the dashboard, and no it won't. Take a look at the example project DashboardDataExample.
Reply With Quote
  #10   Spotlight this post!  
Unread 30-01-2011, 20:27
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 495
tomy has a spectacular aura abouttomy has a spectacular aura about
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);
and it did not work
Reply With Quote
  #11   Spotlight this post!  
Unread 30-01-2011, 20:29
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Re: Gyro + accelometer C++ Programing

Quote:
Originally Posted by tomy View Post
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);
and it did not work
That shouldn't have compiled, here are the available functions for the ADXL345 accelerometer: http://mmrambotics.ca/wpilib/class_a...45___i2_c.html

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.
Reply With Quote
  #12   Spotlight this post!  
Unread 30-01-2011, 20:35
tomy tomy is offline
Registered User
FRC #3038 (I.C.E. Robotics)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Stacy, Minnesota
Posts: 495
tomy has a spectacular aura abouttomy has a spectacular aura about
Re: Gyro + accelometer C++ Programing

tommarow around 4 central time i will post my code here
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 03:05.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi