Arduino Forum

Forum 2005-2010 (read only) => Software => Bugs & Suggestions => Topic started by: charlicharlo on Sep 25, 2007, 12:55 pm

Title: analogsensor input don't work in ext alimentation
Post by: charlicharlo on Sep 25, 2007, 12:55 pm

I don't understand, my arduino has a programm with IR sensor,
when it's connected to usb alimentation, the values are detected, the led-indicator is lighting and switch off when no detection,
When it's in ext alimentation, the led indicator is always lighting, without sensor, with sensor but without people in front...

I forget something but what???

this code

#define DETECT_MIN 128
#define DETECT_MAX 1024
#define SILENCE      500

int inputPinSensor;
int ledPin;
int val;
int byte0;
int byte1;
int byte2;
int byte3;
int byte4;
int byte5;
int byte6;
int byte7;

void setup() {
     val = -1;
     inputPinSensor = 2;
     ledPin = 13;

     pinMode(inputPinSensor, INPUT);
     pinMode(ledPin, OUTPUT);


void loop() {
     val = analogRead(inputPinSensor);
     if (val >= DETECT_MIN && val <= DETECT_MAX) {
           digitalWrite(ledPin, HIGH);
           digitalwrite(ledPin, LOW);


thanks for some help
because Because

Title: Re: analogsensor input don't work in ext alimentat
Post by: bigengineer on Sep 26, 2007, 01:40 pm
This is wrong:
but this shouldn't even compile.
I guess that you mean power supply with alimentation? Didn't you forget the jumper for the external power supply?