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.
This commit is contained in:
Mike Barela 2018-11-04 19:35:01 -05:00 committed by GitHub
parent 63673725eb
commit 1039e2d97d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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));