Go Down

### Topic: multiple maxbotix LVEZ on one UNO? (Read 10053 times)previous topic - next topic

#### Iolanda

#45
##### Jul 02, 2012, 07:06 pm
I am making a miniature imitating a room with a door. I searched how to connect the  sensor's pw to the digital output of Arduino but I didn't succeed. If I won't do a daisy chaining what type shall I pick? I am trying to figure the schematic out so I can start with the source code.

#46

#### Iolanda

#47
##### Jul 11, 2012, 07:21 pm
So I've connected the sensors to analog output. First sensor GND to GND +5v to +5v and Analog to A0.Second sensor Gnd to Gnd +5v to digital pin 5 and analog to A1. I've made a source code but only one sensor detects motion. I am having problem with making them detect motion only when a person is in the room (when sensor 1 detects and after that sensor 2 detcts motion). here is the source code
#define senzor_1 0  //// pinul analogic 0
#define senzor_2 1
int Val_1;
int Val_2;
int Buzz = 8; // pinul 8 la care este conectat

void setup()
{
pinMode(Buzz, OUTPUT);
Serial.begin(9600);
}

void loop()
{
delay(150);
Serial.print("Senzor 1 :");
Serial.println(Val_1);
Serial.print("Senzor 2 :");
Serial.println(Val_2);

if((Val_1 < 12) || (Val_2 < 12))
{
tone(7,262,250);
tone (7,524,250);
}
}

#### TeslaIaint

#48
##### Jul 12, 2012, 02:44 am
You need to divide Val_1 and Val_2 by 2 in order to get inches. If you want centimeters, you have to then multiply that result by 2.54.
http://www.arduino.cc/playground/Main/MaxSonar

Also your sensors are almost certainly interfering with each other. Can't you just use one sensor? If not you need to daisy chain them or learn how to trigger them. There are instructions on how to trigger them earlier in this thread.

Go Up

Please enter a valid email to subscribe