From cf8778292d84663b13c467bbc1a0385712583b60 Mon Sep 17 00:00:00 2001 From: Carlo Parata Date: Thu, 24 Sep 2020 10:56:31 +0200 Subject: [PATCH] Add LED_BUILTIN --- .../VL53L1_Sat_HelloWorld/VL53L1_Sat_HelloWorld.ino | 11 ++++++++--- .../VL53L1_Sat_HelloWorld_Interrupt.ino | 11 ++++++++--- library.properties | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/examples/VL53L1_Sat_HelloWorld/VL53L1_Sat_HelloWorld.ino b/examples/VL53L1_Sat_HelloWorld/VL53L1_Sat_HelloWorld.ino index 6ae74a8..12eb081 100644 --- a/examples/VL53L1_Sat_HelloWorld/VL53L1_Sat_HelloWorld.ino +++ b/examples/VL53L1_Sat_HelloWorld/VL53L1_Sat_HelloWorld.ino @@ -61,6 +61,11 @@ #define DEV_I2C Wire #define SerialPort Serial +#ifndef LED_BUILTIN +#define LED_BUILTIN 13 +#endif +#define LedPin LED_BUILTIN + // Components. VL53L1 *sensor_vl53l1_sat; @@ -69,7 +74,7 @@ VL53L1 *sensor_vl53l1_sat; void setup() { // Led. - pinMode(13, OUTPUT); + pinMode(LedPin, OUTPUT); // Initialize serial for output. SerialPort.begin(115200); @@ -107,7 +112,7 @@ void loop() } while (!NewDataReady); //Led on - digitalWrite(13, HIGH); + digitalWrite(LedPin, HIGH); if((!status)&&(NewDataReady!=0)) { @@ -136,5 +141,5 @@ void loop() } } - digitalWrite(13, LOW); + digitalWrite(LedPin, LOW); } diff --git a/examples/VL53L1_Sat_HelloWorld_Interrupt/VL53L1_Sat_HelloWorld_Interrupt.ino b/examples/VL53L1_Sat_HelloWorld_Interrupt/VL53L1_Sat_HelloWorld_Interrupt.ino index 4d1bbc0..754cb25 100644 --- a/examples/VL53L1_Sat_HelloWorld_Interrupt/VL53L1_Sat_HelloWorld_Interrupt.ino +++ b/examples/VL53L1_Sat_HelloWorld_Interrupt/VL53L1_Sat_HelloWorld_Interrupt.ino @@ -66,6 +66,11 @@ #define DEV_I2C Wire #define SerialPort Serial +#ifndef LED_BUILTIN +#define LED_BUILTIN 13 +#endif +#define LedPin LED_BUILTIN + #define interruptPin A2 // Components. @@ -82,7 +87,7 @@ void setup() { VL53L1_Error status; // Led. - pinMode(13, OUTPUT); + pinMode(LedPin, OUTPUT); pinMode(interruptPin, INPUT_PULLUP); attachInterrupt(interruptPin, measure, FALLING); @@ -124,7 +129,7 @@ void loop() interruptCount=0; // Led blinking. - digitalWrite(13, HIGH); + digitalWrite(LedPin, HIGH); status = sensor_vl53l1_sat->VL53L1_GetMeasurementDataReady(&NewDataReady); if((!status)&&(NewDataReady!=0)) @@ -154,6 +159,6 @@ void loop() } } - digitalWrite(13, LOW); + digitalWrite(LedPin, LOW); } } diff --git a/library.properties b/library.properties index 63f6f9a..2cc1cbc 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=STM32duino VL53L1 -version=1.0.1 +version=1.0.2 author=SRA maintainer=stm32duino sentence=Allows controlling the VL53L1 (Time-of-Flight)