Giter Site home page Giter Site logo

pulsedlight3d / lidarlite_statemachine Goto Github PK

View Code? Open in Web Editor NEW
22.0 22.0 18.0 225 KB

This Arduino sketch demonstrates the various abilities of the LIDAR-Lite Sensor using a simple State Machine.

Home Page: pulsedlight3d.com

License: MIT License

Arduino 100.00%

lidarlite_statemachine's People

Contributors

austinmeyers avatar

Stargazers

 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

lidarlite_statemachine's Issues

Using V3 only outputs 0

I'm using the V3 version of the Lite sensor. When I use the current example software from Garmin, the sensor reports correct values, however when using this code, I only receive a 0 back.

Reading Average Distance

Right now, this code displays an average distance from raw distance data including zero, Can someone help to attribute a new code for reading average distance from raw distance data excluding zero?

llFindSensor() missing while loop?

In the llFindSensor() code:

The i++ (near the end of the function) increments the i value to try a different address since the register 0x02 does not equal 0x80. But, after i is incremented the function exits. There is no while loop to try the next address. Is this a mistake or am I misunderstanding something? Best regards.

void llFindSensor(){
uint8_t nackack = 100; // Setup variable to hold ACK/NACK resopnses
String myString; // Setup string variable to print outcome
bool sensorFound = false; // Setup flag to indicate whether a sensor has been found or not
int i = 0; // Setup a counter
while (nackack != 0){ // While NACK keep going (i.e. continue polling until sucess message (ACK) is received )
LIDARLite_ADDRESS = byte(LIDARLite_ADDRESSES[i]); // Set address from addresses array
nackack = I2c.write(LIDARLite_ADDRESS ,0x41,0x00); // Write 0x00 to read only register 0x41 (will produce an ACK if there is a deice at the device address but won't write anything)
if(nackack != 0){
i++; // If no ACK from write, increment to next address
}else{
break; // If ACK recieved stop while loop
}
delay(2); // Wait 2 ms to prevent overpolling
}
byte testValue[1]; // Create array to store bytes from read
llReadAndWait(0x02,1,testValue); // Read from register 0x02
if(testValue[0] == 0x80){ // If device at address is LIDAR-Lite, register 0x02 should always equal 0x80
myString += "Device @ 0x";
myString += String(byte(LIDARLite_ADDRESS),HEX);
myString += " is LIDAR-Lite.";
smPrintFunctionInit(myString);
}else{ // If register 0x02 does not equal 0x80, increment to next address and try again
i++;
}
}

Arduino IDE Exception

Exception on opening of project file.
arduino-1.0.5

Output:

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
    at processing.app.Sketch.setCurrentCode(Sketch.java:1182)
    at processing.app.Sketch.load(Sketch.java:220)
    at processing.app.Sketch.<init>(Sketch.java:142)
    at processing.app.Editor.handleOpenInternal(Editor.java:2191)
    at processing.app.Editor.<init>(Editor.java:304)
    at processing.app.Base.handleOpen(Base.java:705)
    at processing.app.Base.handleOpen(Base.java:670)
    at processing.app.Base.handleOpenPrompt(Base.java:659)
    at processing.app.Editor$4.actionPerformed(Editor.java:497)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
    at java.awt.Component.processMouseEvent(Component.java:6297)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3275)
    at java.awt.Component.processEvent(Component.java:6062)
    at java.awt.Container.processEvent(Container.java:2039)
    at java.awt.Component.dispatchEventImpl(Component.java:4660)
    at java.awt.Container.dispatchEventImpl(Container.java:2097)
    at java.awt.Component.dispatchEvent(Component.java:4488)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4575)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4236)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4166)
    at java.awt.Container.dispatchEventImpl(Container.java:2083)
    at java.awt.Component.dispatchEvent(Component.java:4488)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:674)
    at java.awt.EventQueue.access$400(EventQueue.java:81)
    at java.awt.EventQueue$2.run(EventQueue.java:633)
    at java.awt.EventQueue$2.run(EventQueue.java:631)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:647)
    at java.awt.EventQueue$3.run(EventQueue.java:645)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:644)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

What about a sensor

Sorry for posting here, but how can i get the sensor? 3DRobotics has none. PulsedLight3D says to buy from them. Could you help?

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.