Shop OBEX P1 Docs P2 Docs Learn Events
Laser Range Finder inerface with Arduino Mega 2560 — Parallax Forums

Laser Range Finder inerface with Arduino Mega 2560

eagletuskeagletusk Posts: 2
edited 2012-02-09 13:38 in Accessories
Just whipped up an example sketch for the Parallax Laser Range Finder using an Arduino Mega.

https://bitbucket.org/eagletusk/parallax-lrf/(mercurial repo)

Mega used because it has two UARTs, a regular Arduino could be used but you will need to bit bang the second on UART, and that doesn't seem like too much fun. If you are interested please branch and post it.

Many thanks to Mr. Grand and Parallax for developing this range finder.

Comments

  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-02-04 18:00
    Looking good.

    If you use Arduino 1.0 you can get a non-UART software-based serial on any pin, and it has *almost* the same functionality at 9600 baud as a hardware UART. The new SoftwareSerial in Arduino 1.0 is based on NewSoftSerial, plus has some enhancements (like based on the Stream class, and having selectable listeners). I don't have a laser ranger finder to test, but your sketch should work with an Uno board as well.

    Your current sketch can be modified by using Serial.write statements instead of Serial.print, and dropping the BYTE modifier, as it's no longer supported. You probably knew that already, but I thought I'd mention.

    -- Gordon
  • eagletuskeagletusk Posts: 2
    edited 2012-02-07 13:02
    Thanks for the heads up on the software serial libarary, I 'll post an update if I decide to work on an arduino uno version. Less latency with two hardware uarts mega... but my 9600 will cancel that out.
  • Joe GrandJoe Grand Posts: 70
    edited 2012-02-09 13:38
    Nice!

    For what it's worth, I've posted some Arduino example code to my Laser Range Finder page. It was written by Roy Eltham and Dino Segovis (makerdino) for Hack A Week episode #13.

    Joe
Sign In or Register to comment.