VL6180 distance sensor c source?

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello folks. I have one of the sparkfun VL6180 I2C distance sensor breakout boards, and I see there is an ino file that reads the chip and displays the distance to an object. Was wondering if anyone has used this gizmo, and has some c source? I have taken a stab at converting some of the cpp stuff to c and its a lot of work it seems. Thanks.

 

Imagecraft compiler user

Last Edited: Wed. Dec 21, 2016 - 01:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You mean one of these:

 

SparkFun ToF Range Finder Breakout - VL6180

https://www.sparkfun.com/product...

 

SparkFun ToF Range Finder Sensor - VL6180

https://www.sparkfun.com/product...

 

bobgardner wrote:
I see there is an ino file ... Was wondering if anyone has ... some c source?

You do realise that .ino is really just C++ ?

 

So shouldn't be hard to convert to C - might even be as simple as just renaming it ...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think ST have some code for their STM32 series. I just used the MBED code for my experiments with this device - but that is c++.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
 but that is c++.

Which, again, is not necessarily hard to translate to C ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cool. I'm ready to attempt to compile your submission of VL6180test.c Thanks in advance.

 

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

10 seconds of Googling found this:

http://www.st.com/content/ccc/re...

 

One of the lines says: "Set of documented C functions"f d

ocumented C functions 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I figgerd it out! Not surprisingly, how to talk to the chip on twi was described in PrettyGoodDetail right in the datasheet. Here's the program

 

Attachment(s): 

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If I might ask Bob... what is the application that needs to measure such a short range so precisely?

 

ps... Just read the file header's "Arnott motorcycle ride height sensor"... what ever that is. Above or below cloud level?

 

Ross McKenzie, Melbourne Australia

Last Edited: Fri. Dec 23, 2016 - 01:08 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I know it's already solved, but when searching for libraries for specific hardware github has become my first goto.

 

https://github.com/search?utf8=%...

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com