Skip to content

Commit 6c1cca0

Browse files
authored
Merge pull request #11 from cparata/master
Add LED_BUILTIN
2 parents f4cd335 + cf87782 commit 6c1cca0

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

examples/VL53L1_Sat_HelloWorld/VL53L1_Sat_HelloWorld.ino

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@
6161
#define DEV_I2C Wire
6262
#define SerialPort Serial
6363

64+
#ifndef LED_BUILTIN
65+
#define LED_BUILTIN 13
66+
#endif
67+
#define LedPin LED_BUILTIN
68+
6469
// Components.
6570
VL53L1 *sensor_vl53l1_sat;
6671

@@ -69,7 +74,7 @@ VL53L1 *sensor_vl53l1_sat;
6974
void setup()
7075
{
7176
// Led.
72-
pinMode(13, OUTPUT);
77+
pinMode(LedPin, OUTPUT);
7378

7479
// Initialize serial for output.
7580
SerialPort.begin(115200);
@@ -107,7 +112,7 @@ void loop()
107112
} while (!NewDataReady);
108113

109114
//Led on
110-
digitalWrite(13, HIGH);
115+
digitalWrite(LedPin, HIGH);
111116

112117
if((!status)&&(NewDataReady!=0))
113118
{
@@ -136,5 +141,5 @@ void loop()
136141
}
137142
}
138143

139-
digitalWrite(13, LOW);
144+
digitalWrite(LedPin, LOW);
140145
}

examples/VL53L1_Sat_HelloWorld_Interrupt/VL53L1_Sat_HelloWorld_Interrupt.ino

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@
6666
#define DEV_I2C Wire
6767
#define SerialPort Serial
6868

69+
#ifndef LED_BUILTIN
70+
#define LED_BUILTIN 13
71+
#endif
72+
#define LedPin LED_BUILTIN
73+
6974
#define interruptPin A2
7075

7176
// Components.
@@ -82,7 +87,7 @@ void setup()
8287
{
8388
VL53L1_Error status;
8489
// Led.
85-
pinMode(13, OUTPUT);
90+
pinMode(LedPin, OUTPUT);
8691
pinMode(interruptPin, INPUT_PULLUP);
8792
attachInterrupt(interruptPin, measure, FALLING);
8893

@@ -124,7 +129,7 @@ void loop()
124129

125130
interruptCount=0;
126131
// Led blinking.
127-
digitalWrite(13, HIGH);
132+
digitalWrite(LedPin, HIGH);
128133

129134
status = sensor_vl53l1_sat->VL53L1_GetMeasurementDataReady(&NewDataReady);
130135
if((!status)&&(NewDataReady!=0))
@@ -154,6 +159,6 @@ void loop()
154159
}
155160
}
156161

157-
digitalWrite(13, LOW);
162+
digitalWrite(LedPin, LOW);
158163
}
159164
}

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=STM32duino VL53L1
2-
version=1.0.1
2+
version=1.0.2
33
author=SRA
44
maintainer=stm32duino
55
sentence=Allows controlling the VL53L1 (Time-of-Flight)

0 commit comments

Comments
 (0)