From: Advaith Menon <83835839+advaithm582@users.noreply.github.com> Date: Fri, 19 Sep 2025 15:21:37 +0000 (-0400) Subject: Fix up/down adjustment for g X-Git-Url: https://git.devinivas.org/?a=commitdiff_plain;h=dd7b4a2d5ccd3e5b4050594df66c4a0854ff58c6;p=gt-ece4180-lab02.git Fix up/down adjustment for g --- diff --git a/02-I2CIMU/02-I2CIMU.ino b/02-I2CIMU/02-I2CIMU.ino index c83b169..425f0ef 100644 --- a/02-I2CIMU/02-I2CIMU.ino +++ b/02-I2CIMU/02-I2CIMU.ino @@ -11,7 +11,7 @@ #define NUM_LEDS 1 #define LED_PIN 8 /* TODO */ -#define GOOD_VAL 1000 +#define GOOD_VAL 2000 #define I2C_ADDR ICM_20948_I2C_ADDR_AD1 #define CLOCKF 400000 @@ -118,7 +118,7 @@ void setup() { ICM_20948_low_power(&imu, false); pixel.begin(); - pixel.setBrightness(100); + pixel.setBrightness(50); } @@ -145,6 +145,8 @@ void color_change(int16_t x, int16_t y, int16_t z) { uint16_t xa, ya, za; int16_t co; // chosen one struct color c; + + z = z - 16000; /* find direction */ xa = (x < 0) ? -x : x; ya = (y < 0) ? -y : y; @@ -154,12 +156,15 @@ void color_change(int16_t x, int16_t y, int16_t z) { if (xa >= GOOD_VAL) { curr_col = 0; co = x; + Serial.println("X AXIS"); } else if (ya >= GOOD_VAL) { curr_col = 1; co = y; + Serial.println("Y AXIS"); } else if (za >= GOOD_VAL) { curr_col = 2; co = z; + Serial.println("Z AXIS"); } curr_dir = (co < 0) ? 1 : 0;