pulsedlight3d / lidarlite_statemachine Goto Github PK
View Code? Open in Web Editor NEWThis Arduino sketch demonstrates the various abilities of the LIDAR-Lite Sensor using a simple State Machine.
Home Page: pulsedlight3d.com
License: MIT License
This Arduino sketch demonstrates the various abilities of the LIDAR-Lite Sensor using a simple State Machine.
Home Page: pulsedlight3d.com
License: MIT License
Please add the images for the documentation provided.
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.
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?
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++;
}
}
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)
Sorry for posting here, but how can i get the sensor? 3DRobotics has none. PulsedLight3D says to buy from them. Could you help?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.