Code Monkey home page Code Monkey logo

arduino-maxbotix's Introduction

Hi there 👋

Somehow you've landed here 🤔

I am probably building something or learning some stuff. Feel free to look around, check my contributions below, website and LinkedIn profile.

arduino-maxbotix's People

Contributors

diaoul avatar perraudeau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-maxbotix's Issues

Multi-instance software serial

Hi,

I have a problem when use this library, i use two maxbotix in arduino nano, and when i read from Serial, using Rx SoftwareSerial.h, i don't receive anything from Monitor Serie.

But if i use one maxbotix with serial, and another with Digital, the program work without any problem.
This is my code:
#include "Maxbotix.h"
#include <ros.h>
#include <ros/time.h>
#include <sensor_msgs/Range.h>

//Sonar A (EZ4)
//#ifdef MAXBOTIX_WITH_SOFTWARE_SERIAL
Maxbotix rangeSensorTXA(6, Maxbotix::TX, Maxbotix::LV);
//#endif
//Set up the ros node and publisher
sensor_msgs::Range sonar_TXA_msg;
ros::Publisher pub_sonar_TXA("sonarTXA", &sonar_TXA_msg);

//sonar B (EZ0)
//#ifdef MAXBOTIX_WITH_SOFTWARE_SERIAL
Maxbotix rangeSensorTXB(8, Maxbotix::TX, Maxbotix::LV);
//#endif
//Set up the ros node and publisher
sensor_msgs::Range sonar_TXB_msg;
ros::Publisher pub_sonar_TXB("sonarTXB", &sonar_TXB_msg);

ros::NodeHandle nh;

void setup()
{
Serial.begin(9600);
//seleccionamos los pin de control
//Sonar A
pinMode(5, OUTPUT);

//Sonar B
pinMode(4, OUTPUT);

nh.initNode();

//mensaje SERIAL A
nh.advertise(pub_sonar_TXA);
sonar_TXA_msg.radiation_type = sensor_msgs::Range::ULTRASOUND;
sonar_TXA_msg.header.frame_id = "/sonar_range";
sonar_TXA_msg.field_of_view = 0.4;
sonar_TXA_msg.min_range = 0.15;
sonar_TXA_msg.max_range = 6.45;

//mensaje SERIAL B
nh.advertise(pub_sonar_TXB);
sonar_TXB_msg.radiation_type = sensor_msgs::Range::ULTRASOUND;
sonar_TXB_msg.header.frame_id = "/sonar_range";
sonar_TXB_msg.field_of_view = 0.7;
sonar_TXB_msg.min_range = 0.15;
sonar_TXB_msg.max_range = 6.45;
}

long range_timer;

void loop()
{
if ((millis() - range_timer) > 1000)
{
//SERIAL A
digitalWrite(5, HIGH);
delayMicroseconds(50);
digitalWrite(5, LOW);
sonar_TXA_msg.range = rangeSensorTXA.getRange();
sonar_TXA_msg.header.stamp = nh.now();
Serial.print("TXA = ");
Serial.println(sonar_TXA_msg.range);
pub_sonar_TXA.publish(&sonar_TXA_msg);

  //SERIAL B
  digitalWrite(4, HIGH);
  delayMicroseconds(50);
  digitalWrite(4, LOW);
  sonar_TXB_msg.range = rangeSensorTXB.getRange();
  sonar_TXB_msg.header.stamp = nh.now();
  Serial.print("TXB = ");
  Serial.println(sonar_TXB_msg.range);
  pub_sonar_TXB.publish(&sonar_TXB_msg);

  Serial.println(" ");
  range_timer = millis();

}
nh.spinOnce();
}

Thanks so much and sorry for my english.
Skained

Analog Read - LV Calculations

I am working to use the library to calculate the MB1010 LV-MaxSonar®-EZ1™ range. However, looking through your code, the calculation you make is:

result = toCentimeters(analogRead(pin) / 2.0);

How does the Analog Value In/2 = the value converted to inches? Or is this just a random number that got it close to the actual value but not really?

Disabled RxSoftwareSerial not reflected in examples

rangeSensorTx features in both Simple and Advanced examples, but has been disabled in the library files.

You can either remove rangeSensorTX from the examples, or restore RxSoftwareSerial as it has been disabled for a reason not known to me.

Simple code does not work

Not sure whats going on here, but this is the error that I get when trying to verify the Simple code:

MaxbotixSonar/Maxbotix.cpp.o: In function Maxbotix::getRange()': /usr/share/arduino/libraries/MaxbotixSonar/Maxbotix.cpp:77: undefined reference tooperator new[](unsigned int)'
/usr/share/arduino/libraries/MaxbotixSonar/Maxbotix.cpp:67: undefined reference to `operator delete'
collect2: ld returned 1 exit status

Any help would be greatly appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.