-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from sparkfun/Intermeasurement-period
updating to lite, wrapped version of ST library
- Loading branch information
Showing
21 changed files
with
2,695 additions
and
12,879 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,23 @@ | ||
SparkFun License Information | ||
============================ | ||
|
||
SparkFun uses two different licenses for our files — one for hardware and one for code. | ||
|
||
Hardware | ||
--------- | ||
|
||
**SparkFun hardware is released under [Creative Commons Share-alike 4.0 International](http://creativecommons.org/licenses/by-sa/4.0/).** | ||
|
||
Note: This is a human-readable summary of (and not a substitute for) the [license](http://creativecommons.org/licenses/by-sa/4.0/legalcode). | ||
|
||
You are free to: | ||
|
||
Share — copy and redistribute the material in any medium or format | ||
Adapt — remix, transform, and build upon the material | ||
for any purpose, even commercially. | ||
The licensor cannot revoke these freedoms as long as you follow the license terms. | ||
Under the following terms: | ||
|
||
Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. | ||
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. | ||
No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. | ||
Notices: | ||
|
||
You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation. | ||
No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material. | ||
|
||
|
||
Code | ||
-------- | ||
|
||
**SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).** | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 SparkFun Electronics | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
COPYRIGHT(c) 2018 STMicroelectronics | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
1. Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
3. Neither the name of STMicroelectronics nor the names of its contributors | ||
may be used to endorse or promote products derived from this software | ||
without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
53 changes: 53 additions & 0 deletions
53
examples/Example1_ReadDistance/Example1_ReadDistance/Example1_ReadDistance.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
Reading distance from the laser based VL53L1X | ||
By: Nathan Seidle | ||
SparkFun Electronics | ||
Date: April 4th, 2018 | ||
License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license). | ||
SparkFun labored with love to create this code. Feel like supporting open source hardware? | ||
Buy a board from SparkFun! https://www.sparkfun.com/products/14667 | ||
This example prints the distance to an object. | ||
Are you getting weird readings? Be sure the vacuum tape has been removed from the sensor. | ||
*/ | ||
|
||
#include <Wire.h> | ||
//#include "vl53l1x_class.h" | ||
#include "SparkFun_VL53L1X.h" | ||
|
||
SFEVL53L1X distanceSensor(Wire, 2, 3); | ||
int distance; | ||
|
||
void setup(void) | ||
{ | ||
Wire.begin(); | ||
|
||
Serial.begin(9600); | ||
Serial.println("VL53L1X Qwiic Test"); | ||
|
||
if (distanceSensor.init() == 0) | ||
{ | ||
Serial.println("Sensor online!"); | ||
} | ||
} | ||
|
||
void loop(void) | ||
{ | ||
distanceSensor.startRanging(); //Write configuration bytes to initiate measurement | ||
distance = distanceSensor.getDistance(); //Get the result of the measurement from the sensor | ||
distanceSensor.stopRanging(); //Write configuration bytes to initiate measurement | ||
|
||
float distanceInches = distance * 0.0393701; //calculate Feet | ||
float distanceFeet = distanceInches / 12.0; | ||
|
||
Serial.print("Distance(mm): "); | ||
Serial.print(distance); | ||
Serial.print("\tDistance(ft): "); | ||
Serial.print(distanceFeet, 2); | ||
|
||
Serial.println(); | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.