background image

 

VMA349 

V. 01 

 01/04/2020 

©Velleman nv 

8.

 

Sample Sketch 

 

 

/* 

 

Example code for Benewake TFMini time-of-flight distance sensor. 

 

by Peter Jansen (December 11/2017) 

 

This example code is in the public domain. 

 

 

 

This example communicates to the TFMini using a SoftwareSerial port at 115200,  

 

while communicating the distance results through the default Arduino hardware 

 

serial debug port.  

 

 

 

SoftwareSerial for some boards can be unreliable at high speeds (such as 115200).  

 

The driver includes some limited error detection and automatic retries, that 

 

means it can generally work with SoftwareSerial on (for example) an UNO without 

 

the end-user noticing many communications glitches, as long as a constant refresh 

 

rate is not required.  

 

 

 

The (UNO) circuit: 

 

 * Uno RX is digital pin 10 (connect to TX of TF Mini) 

 

 * Uno TX is digital pin 11 (connect to RX of TF Mini) 

 

 

 

THIS SOFTWARE IS PROVIDED ''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 AUTHOR(S) 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. 

 

*/ 

 

 

 

#include <SoftwareSerial.h> 

 

#include "TFMini.h" 

 

 

 

// Setup software serial port  

 

SoftwareSerial mySerial(10, 11);      // Uno RX (TFMINI TX), Uno TX (TFMINI RX) 

 

TFMini tfmini; 

 

 

 

void setup() { 

 

  // Step 1: Initialize hardware serial port (serial debug port) 

 

  Serial.begin(115200); 

 

  // wait for serial port to connect. Needed for native USB port only 

 

  while (!Serial); 

 

 

 

  Serial.println ("Initializing..."); 

 

 

 

  // Step 2: Initialize the data rate for the SoftwareSerial port 

 

  mySerial.begin(TFMINI_BAUDRATE); 

 

 

Summary of Contents for VMA349

Page 1: ...VMA349 USER MANUAL 2...

Page 2: ...8 years and above and persons with reduced physical sensory or mental capabilities or lack of experience and knowledge if they have been given supervision or instruction concerning the use of the devi...

Page 3: ...light principle and integrates unique optical and electrical designs so as to achieve stable precise high sensitivity and high speed distance detection ToF s operating principle is as follows a modula...

Page 4: ...e VMA349 to the VMA410 and VMA100 as in the table above 2 Download the tfmini master zip file from our website 3 Open the Arduino IDE and load the tfmini master zip library 4 Once the library is loade...

Page 5: ...e like this distance from VMA439 to object 203 cm signal strength 136 Be sure the baud rate is at 115200 baud As this baud rate is quite high try to use short RX TX wires otherwise glitches can appear...

Page 6: ...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 AUTHOR S BE LIABLE FOR A...

Page 7: ...unit cm wavelength 850 mm communication interface UART 115200 LED peak current 800 mA serial port TTL voltage level 3 3 V dimensions 42 15 16 mm 1 65 x 0 6 x 0 62 operating temperature 20 to 60 C wei...

Page 8: ...shocks falls dust dirt humidity and by the article as well as its contents e g data loss compensation for loss of profits consumable goods parts or accessories that are subject to an aging process du...

Reviews: