View Single Post
  #7   Spotlight this post!  
Unread 04-01-2007, 01:25
prograid's Avatar
prograid prograid is offline
Registered User
AKA: Ben Cherian
FRC #0254 (The Cheesy Poofs)
Team Role: Alumni
 
Join Date: Oct 2004
Rookie Year: 2004
Location: San Jose
Posts: 80
prograid will become famous soon enough
Re: Set Default Digital inputs to Low? How? bad Analog value?

Quote:
Originally Posted by Generalx5 View Post
Is there still a way to make the Digital Inputs default to low?
I don't think so.
Quote:
Originally Posted by Generalx5 View Post

The other way to do this is...making them all analog? would that work?
Yes, I believe it would.

Well, from your description of the sensor, it seems that you could plug it in to an analog input, and then simply use it as a sort of digital sensor in the following manner (let's pretend the sensor is plugged into analog input 1):
PHP Code:
#define TRUE !0
#define FALSE 1
#define THRESHOLD_VALUE 500
#define OBJECT_SENSOR_INPUT rc_ana_in01
unsigned char objectNearby;
/*You may need to use "<" if I misunderstood how the sensor works*/
if(Get_Analog_Value(OBJECT_SENSOR_INPUT) > THRESHOLD_VALUE) { 
    
objectNearby TRUE;
} else {
    
objectNearby FALSE;

You can then use the objectNearby variable to check for the presence of the object and you can change the THRESHOLD_VALUE to make the sensor more or less sensitive.

Last edited by prograid : 04-01-2007 at 15:39.