Skip to content

Add LED_BUILTIN #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions examples/VL53L1_Sat_HelloWorld/VL53L1_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.
VL53L1 *sensor_vl53l1_sat;

Expand All @@ -69,7 +74,7 @@ VL53L1 *sensor_vl53l1_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()
{
VL53L1_Error status;
// Led.
pinMode(13, OUTPUT);
pinMode(LedPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(interruptPin, measure, FALLING);

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -154,6 +159,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 VL53L1
version=1.0.1
version=1.0.2
author=SRA
maintainer=stm32duino
sentence=Allows controlling the VL53L1 (Time-of-Flight)
Expand Down