Skip to content

Commit

Permalink
Merge pull request #4 from cparata/master
Browse files Browse the repository at this point in the history
Add LED_BUILTIN
  • Loading branch information
cparata authored Sep 24, 2020
2 parents a5825ef + 50db65d commit 3bfdd40
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
11 changes: 8 additions & 3 deletions examples/VL53L3CX_Sat_HelloWorld/VL53L3CX_Sat_HelloWorld.ino
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
#define DEV_I2C Wire
#define SerialPort Serial

#ifndef LED_BUILTIN
#define LED_BUILTIN 13
#endif
#define LedPin LED_BUILTIN

// Components.
VL53LX *sensor_vl53lx_sat;

Expand All @@ -70,7 +75,7 @@ VL53LX *sensor_vl53lx_sat;
void setup()
{
// Led.
pinMode(13, OUTPUT);
pinMode(LedPin, OUTPUT);

// Initialize serial for output.
SerialPort.begin(115200);
Expand Down Expand Up @@ -107,7 +112,7 @@ void loop()
} while (!NewDataReady);

//Led on
digitalWrite(13, HIGH);
digitalWrite(LedPin, HIGH);

if((!status)&&(NewDataReady!=0))
{
Expand Down Expand Up @@ -136,5 +141,5 @@ void loop()
}
}

digitalWrite(13, LOW);
digitalWrite(LedPin, LOW);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -82,7 +87,7 @@ void setup()
{
VL53LX_Error status;
// Led.
pinMode(13, OUTPUT);
pinMode(LedPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(interruptPin, measure, FALLING);

Expand Down Expand Up @@ -122,7 +127,7 @@ void loop()

interruptCount=0;
// Led blinking.
digitalWrite(13, HIGH);
digitalWrite(LedPin, HIGH);

status = sensor_vl53lx_sat->VL53LX_GetMeasurementDataReady(&NewDataReady);
if((!status)&&(NewDataReady!=0))
Expand Down Expand Up @@ -152,6 +157,6 @@ void loop()
}
}

digitalWrite(13, LOW);
digitalWrite(LedPin, LOW);
}
}
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=STM32duino VL53L3CX
version=1.0.1
version=1.0.2
author=STMicroelectronics
maintainer=stm32duino
sentence=Allows controlling the VL53L3CX (Time-of-Flight ranging sensor with multi target detection)
Expand Down

0 comments on commit 3bfdd40

Please sign in to comment.