Go to Post Every team in FIRST can make this choice. Be positive, help others, and work like a maniac behind the scenes. This approach will bring you joy and satisfaction, whether you win or not. - OZ_341 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-02-2005, 16:32
psquared psquared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Chantilly
Posts: 34
psquared is an unknown quantity at this point
Accelerometer: Analog or Digital?

We had our accelerometer connected to an Analog port, which we thought it was, but when we printfed the Get_Analog_Value(blah) it showed up some huge number like 17439, the value that we made get_analog_value go to was a double value, and we printfed with %d, when we moved the accelerometer no value changed

should it be an int instead of double?
do you think our connections might be wrong?
should it be digital instead?
or any other thing it might be?

thanks for the help

Chantilly 612
  #2   Spotlight this post!  
Unread 10-02-2005, 16:37
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: Accelerometer: Analog or Digital?

The accelerometer is definitely an analog sensor. Make sure you have the wires connected correctly; the color code is nonstandard. Black goes to +5 volt power, red goes to ground, and white is the output to the RC.
Quote:
Originally Posted by psquared
should it be an int instead of double?
The value returned by the Get_Analog_Value() function is a ten-bit integer. It can range from 0 to 1023.

Last edited by Alan Anderson : 10-02-2005 at 16:40.
  #3   Spotlight this post!  
Unread 10-02-2005, 16:38
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,854
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Accelerometer: Analog or Digital?

Quote:
Originally Posted by psquared
We had our accelerometer connected to an Analog port, which we thought it was, but when we printfed the Get_Analog_Value(blah) it showed up some huge number like 17439, the value that we made get_analog_value go to was a double value, and we printfed with %d, when we moved the accelerometer no value changed

should it be an int instead of double?
do you think our connections might be wrong?
should it be digital instead?
or any other thing it might be?

thanks for the help

Chantilly 612
You are correct it is an analog input.

The easiest mistake to make is the colors of the wires on the accelerometer are not normal. Check the spec sheet for how they should be swapped around.

Get_Analog_Value returns an int.
When you printf make sure you are printing an int.
The accelerometer should return a value in the neighborhood of
--730 when facing up
--512 when horizontal
--340 when facing down
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Digital Caliper as a Digital Readout on Small Mill sanddrag Technical Discussion 9 13-10-2005 22:51
Analog / Digital IO Connectors Aidan F. Browne Control System 4 06-02-2005 22:26
Example accelerometer code released. Kevin Watson Programming 0 20-01-2005 03:45
Dynamic Input/Output Changing Paolo Control System 6 23-09-2004 19:09
heres the code. y this not working omega Programming 16 31-03-2004 15:18


All times are GMT -5. The time now is 19:20.

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