From 5c9c5c6b68ebd627a5078ac6ad3135d0122cbb5b Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Thu, 13 May 2021 20:31:25 -0400 Subject: [PATCH] display sensor data over Serial when first powered up --- arduino/Payload_BME280_MPU6050_XS.ino | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arduino/Payload_BME280_MPU6050_XS.ino b/arduino/Payload_BME280_MPU6050_XS.ino index befacfc3..b7280828 100644 --- a/arduino/Payload_BME280_MPU6050_XS.ino +++ b/arduino/Payload_BME280_MPU6050_XS.ino @@ -19,6 +19,7 @@ int Sensor2 = 0; float Sensor3 = 0; void eeprom_word_write(int addr, int val); short eeprom_word_read(int addr); +int first_time = true; void setup() { @@ -84,7 +85,7 @@ void setup() { void loop() { - if (Serial.available() > 0) { + if ((Serial.available() > 0)|| first_time == true) { blink(50); char result = Serial.read(); // Serial.println(result); @@ -95,8 +96,9 @@ void loop() { setup(); } - if (result == '?') + if ((result == '?') || first_time == true) { + first_time = false; if (bmePresent) { Serial.print("OK BME280 "); Serial.print(bme.readTemperature());