Go to Post So take it all with a grain of salt, form your own opinions, lead by example, act responsibly, be graciously professional, and everything will be ok. - LauraN [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 16-03-2014, 11:08
Cataclysmatic Cataclysmatic is offline
Registered User
AKA: Tyler Thompson
FRC #4296 (Trident Robotics)
Team Role: Driver
 
Join Date: Jan 2013
Rookie Year: 2012
Location: United States
Posts: 32
Cataclysmatic is on a distinguished road
MaxBotix Sonar Sensor Analog not working

Hello,

I have recently been trying to test a few things sensor wise in advance of our next regional, but I cannot seem to get the MaxBotix Sonar sensor to work, everything seems to be fine by multimeter, but I am not actually able to read a voltage in C++ using GetVoltage() or GetAverageVoltage(), I assume either one of these would probably work for my desired function.

How the sonar is wired/plugged into the analog card in slot 1:
http://imgur.com/idGN4Tr
http://imgur.com/Ajw5fmr

As for the actual code:
Declaration:
Quote:
AnalogChannel *Sonar;
double voltageSonar;
Construction I have tried two different ways, neither have worked.
Quote:
Sonar = new AnalogChannel(1, 8);
Quote:
Sonar = new AnalogChannel(8);
Inside TeleopPeriodic I have tried:
Code:
voltageSonar = Sonar->GetVoltage();
voltageSonar = Sonar->GetAverageVoltage();//Only used one of these, but are both methods I used for testing.
//---------------------
SmartDashboard::PutNumber9"Voltage: ", voltageSonar);
I know that I still have to scale the voltage, but I actually need to read a voltage in order to do so... Does anyone have any ideas as to what I am doing incorrectly?
Thanks!

Last edited by Cataclysmatic : 16-03-2014 at 11:10.
Reply With Quote
  #2   Spotlight this post!  
Unread 16-03-2014, 13:36
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,557
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: MaxBotix Sonar Sensor Analog not working

You can't use Analog Channel 8 on Module 1, it is used for battery voltage monitoring. Choose another channel.
Reply With Quote
  #3   Spotlight this post!  
Unread 16-03-2014, 15:02
Cataclysmatic Cataclysmatic is offline
Registered User
AKA: Tyler Thompson
FRC #4296 (Trident Robotics)
Team Role: Driver
 
Join Date: Jan 2013
Rookie Year: 2012
Location: United States
Posts: 32
Cataclysmatic is on a distinguished road
Re: MaxBotix Sonar Sensor Analog not working

Should have probably checked at each channel, I know there are other spots throughout that do not function properly because of things like that.

Thanks for the help, it now is functioning properly.
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 02:43.

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