TF mini Lidar and Adafruit Feather M0 Express

Hello,

I need some help to use the Hardware serial to connect TF mini Lidar and Adafruit Feather M0 Express.

I got a conflicting declaration 'HardwareSerial Serial1' with the test code :

#include "TFmini.h"

HardwareSerial Serial1(1);
HardwareSerial Serial2(2);
TFmini tfmini[2];

void setup()
{
Serial.begin(115200);
Serial1.begin(TFmini::DEFAULT_BAUDRATE, SERIAL_8N1, 26, 27);
Serial2.begin(TFmini::DEFAULT_BAUDRATE);
tfmini[0].attach(Serial1);
tfmini[1].attach(Serial2);
}

void loop()
{
for (uint8_t i = 0; i < 2; ++i)
{
if (tfmini*.available())*

  • {*
  • Serial.print("tfmini ");*
  • Serial.println(i);*
  • Serial.print("distance : ");*
    _ Serial.println(tfmini*.getDistance());_
    _
    Serial.print("strength : ");_
    _ Serial.println(tfmini.getStrength());
    Serial.print("int time : ");
    Serial.println(tfmini.getIntegrationTime());
    }
    }
    }*_

Please post your code in code tags, and post the actual error message.

I think there's more involved with bringing another Serial port (let alone 2 more) online with the Feather M0 than what you've tried: Overview | Using ATSAMD21 SERCOM for more SPI, I2C and Serial ports | Adafruit Learning System