Pages: [1]   Go Down
Author Topic: analogsensor input don't work in ext alimentation  (Read 399 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

lo',

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

[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;
      byte0=0;
      byte1=1;
       byte2=2;
       byte3=3;
       byte4=4;
       byte5=5;
       byte6=6;
       byte7=7;

      pinMode(inputPinSensor, INPUT);
      pinMode(ledPin, OUTPUT);
      pinMode(byte0,OUTPUT);
      pinMode(byte1,OUTPUT);
      pinMode(byte2,OUTPUT);
      pinMode(byte3,OUTPUT);
      pinMode(byte4,OUTPUT);
      pinMode(byte5,OUTPUT);
      pinMode(byte6,OUTPUT);
      pinMode(byte7,OUTPUT);


      digitalWrite(byte0,HIGH);
      digitalWrite(byte1,HIGH);
      digitalWrite(byte2,HIGH);
      digitalWrite(byte3,HIGH);
      digitalWrite(byte4,HIGH);
      digitalWrite(byte5,HIGH);
      digitalWrite(byte6,HIGH);
      digitalWrite(byte7,HIGH);
      
}      

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

[\code]

thanks for some help
because Because

Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 183
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is wrong:
digitalWritebyte0,HIGH);
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?
Logged

Pages: [1]   Go Up
Jump to: