Pages: 1 2 3 [4]   Go Down
Author Topic: multiple maxbotix LVEZ on one UNO?  (Read 5625 times)
0 Members and 1 Guest are viewing this topic.
Arges, Romania
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Ontario, Ohio
Offline Offline
Full Member
***
Karma: 1
Posts: 209
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.instructables.com/id/Getting-started-with-the-Maxbotix-sonar-sensor-q/
Logged

Arges, Romania
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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()
{
  Val_1=analogRead(senzor_1);
  Val_2=analogRead(senzor_2);
  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);
  }
}
Logged

Ontario, Ohio
Offline Offline
Full Member
***
Karma: 1
Posts: 209
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: 1 2 3 [4]   Go Up
Jump to: