View unanswered posts | View active topics It is currently Sat Jul 26, 2014 5:49 am






Reply to topic  [ 3 posts ] 
Configuring Sensor Within Program 
Author Message
Expert

Joined: Wed Jun 30, 2010 7:15 am
Posts: 181
Post Configuring Sensor Within Program
Is there a way to configure a sensor from within the program, according to user input? I've tried it using
Code:
SensorType[sensor] = sensorHiTechnicMagnetic
But the sensor is still configured the way I originally initialized it (as a sensorNone), and it gives me an error saying that variable "sensor" was never defined, while, at the start of the program, I configured it using this
Code:
#pragma config(Sensor, S1,     sensor,         sensorNone)
If it's impossible to configure within the program, is there any way to detect what sensor is connected to a given port? (I think it'd be possible with I2C, for digital sensors at least, but I'm just wondering if there is an easier way)

Thanks!

_________________
leonoverweel.com


Last edited by DiMastero on Sun Feb 26, 2012 4:22 pm, edited 1 time in total.



Sun Feb 26, 2012 4:19 pm
Profile WWW
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Re: Configuring Sensor Within Program
DiMastero wrote:
Is there a way to configure a sensor from within the program, according to user input? I've tried it using
Code:
SensorType[sensor] = sensorHiTechnicMagnetic
But the sensor is still configured the way I originally initialized it (as a touch sensor)

If that's impossible, is there any way to detect what sensor is connected to a given port? (I think it'd be possible with I2C, for digital sensors at least, but I'm just wondering if there is an easier way)

Thanks!


Is this what your looking for?

Code:
SetSensorType(tSensorsLink, SensorType);

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Sun Feb 26, 2012 4:22 pm
Profile WWW
Expert

Joined: Wed Jun 30, 2010 7:15 am
Posts: 181
Post Re: Configuring Sensor Within Program
Yup, that's it. Thanks!

_________________
leonoverweel.com


Sun Feb 26, 2012 4:30 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.