20
20
21
21
/* *********************** Example Starts Here *******************************/
22
22
#include < Wire.h>
23
- #include < SPI.h>
24
23
#include < Adafruit_LIS3DH.h>
25
24
#include < Adafruit_Sensor.h>
26
25
#include < Adafruit_NeoPixel.h>
27
26
28
27
// Prop-Maker Wing
29
28
#define NEOPIXEL_PIN 2
30
- #define POWER_PIN 15
31
- #define RED_LED 13
32
- #define GREEN_LED 12
33
- #define BLUE_LED 14
29
+ #define POWER_PIN 15
34
30
35
31
// Used for Pizeo
36
32
#define PIEZO_PIN 0
37
33
38
- // NeoPixel Pin
39
- #define NEOPIXEL_PIN 5
40
-
41
34
// # of Pixels Attached
42
35
#define NUM_PIXELS 8
43
36
44
- // Used for software SPI
45
- #define LIS3DH_CLK 13
46
- #define LIS3DH_MISO 12
47
- #define LIS3DH_MOSI 11
48
- // Used for hardware & software SPI
49
- #define LIS3DH_CS 10
50
-
51
37
// Adafruit_LIS3DH Setup
52
38
Adafruit_LIS3DH lis = Adafruit_LIS3DH();
53
39
@@ -89,18 +75,10 @@ void setup()
89
75
;
90
76
Serial.println (" Adafruit IO Time Tracking Cube" );
91
77
92
- // enabling RGB and NeoPixels on Prop-Maker Featherwing
78
+ // disabling low-power mode on the prop-maker wing
93
79
pinMode (POWER_PIN, OUTPUT);
94
- digitalWrite (POWER_PIN, LOW);
95
- pinMode (RED_LED, OUTPUT);
96
- pinMode (GREEN_LED, OUTPUT);
97
- pinMode (BLUE_LED, OUTPUT);
98
-
99
- analogWrite (RED_LED, 0 );
100
- analogWrite (GREEN_LED, 0 );
101
- analogWrite (BLUE_LED, 0 );
80
+ digitalWrite (POWER_PIN, HIGH);
102
81
103
-
104
82
// Initialize LIS3DH
105
83
if (!lis.begin (0x18 ))
106
84
{
@@ -129,7 +107,6 @@ void setup()
129
107
// we are connected
130
108
Serial.println ();
131
109
Serial.println (io.statusText ());
132
-
133
110
}
134
111
135
112
void updateTime ()
@@ -147,12 +124,8 @@ void updateTime()
147
124
148
125
void updatePixels (uint8_t red, uint8_t green, uint8_t blue)
149
126
{
150
- // updates pixels on the prop-maker featherwing
151
- digitalWrite (POWER_PIN, HIGH);
152
- analogWrite (RED_LED, 0 );
153
- analogWrite (GREEN_LED, 0 );
154
- analogWrite (BLUE_LED, 0 );
155
- for (int p=0 ; p<NUM_PIXELS; p++) {
127
+ for (int p = 0 ; p < NUM_PIXELS; p++)
128
+ {
156
129
strip.setPixelColor (p, red, green, blue);
157
130
}
158
131
strip.show ();
@@ -184,13 +157,13 @@ void loop()
184
157
// Serial.println("Cube TILTED: Right");
185
158
cubeState = 2 ;
186
159
}
187
- else if (event.acceleration .y < 0 && event.acceleration .y > -1 )
160
+ else if (event.acceleration .y < 0 && event.acceleration .y > -1 )
188
161
{
189
162
cubeState = 3 ;
190
163
}
191
164
else
192
165
{ // orientation not specified
193
- Serial.println (" Cube Idle..." );
166
+ // Serial.println("Cube Idle...");
194
167
}
195
168
196
169
// return if the orientation hasn't changed
0 commit comments