From 1039e2d97d47a2a5b5fd7d1530f258cdd62cb690 Mon Sep 17 00:00:00 2001 From: Mike Barela Date: Sun, 4 Nov 2018 19:35:01 -0500 Subject: [PATCH] Changes to remove temp global variable Per https://3.basecamp.com/3732686/buckets/4383362/todos/1319808931#__recording_1402164150 John, I took the check to see if the acceleration was positive and put that check directly in the if statement. Then the code to set tilt is not needed and the variable declaration is unneeded. Please review & try and then if this PR or your edits are good, we can look to merge. --- Munny_Lamp/Munny_Lamp.ino | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Munny_Lamp/Munny_Lamp.ino b/Munny_Lamp/Munny_Lamp.ino index d78da780..502d0246 100644 --- a/Munny_Lamp/Munny_Lamp.ino +++ b/Munny_Lamp/Munny_Lamp.ino @@ -24,8 +24,6 @@ int blue = 0; #include "BluefruitConfig.h" Adafruit_LIS3DH lis = Adafruit_LIS3DH(); -int tilt = 0; // for testing tilt of accelerometer - /*========================================================================= APPLICATION SETTINGS @@ -200,14 +198,7 @@ void accelerometer_check() { Serial.print(" \tZ: "); Serial.print(event.acceleration.z); Serial.println(" m/s^2 "); - if (event.acceleration.y < 0) { - tilt = 1; - } - else if (event.acceleration.y >= 0) { - tilt = 0; - } - - if (tilt==1) { + if (event.acceleration.y >= 0) { analogWrite(RED_LED, random(0, 255)); analogWrite(GREEN_LED, random(0, 255)); analogWrite(BLUE_LED, random(0, 255));