Skip to content

Commit f32d62b

Browse files
authored
Merge pull request #75 from brentru/update-example-zapier
Clean up Zapier Example
2 parents 52051e0 + 09e6209 commit f32d62b

File tree

1 file changed

+7
-34
lines changed

1 file changed

+7
-34
lines changed

examples/adafruitio_24_zapier/adafruitio_24_zapier.ino

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,20 @@
2020

2121
/************************ Example Starts Here *******************************/
2222
#include <Wire.h>
23-
#include <SPI.h>
2423
#include <Adafruit_LIS3DH.h>
2524
#include <Adafruit_Sensor.h>
2625
#include <Adafruit_NeoPixel.h>
2726

2827
// Prop-Maker Wing
2928
#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
3430

3531
// Used for Pizeo
3632
#define PIEZO_PIN 0
3733

38-
// NeoPixel Pin
39-
#define NEOPIXEL_PIN 5
40-
4134
// # of Pixels Attached
4235
#define NUM_PIXELS 8
4336

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-
5137
// Adafruit_LIS3DH Setup
5238
Adafruit_LIS3DH lis = Adafruit_LIS3DH();
5339

@@ -89,18 +75,10 @@ void setup()
8975
;
9076
Serial.println("Adafruit IO Time Tracking Cube");
9177

92-
// enabling RGB and NeoPixels on Prop-Maker Featherwing
78+
// disabling low-power mode on the prop-maker wing
9379
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);
10281

103-
10482
// Initialize LIS3DH
10583
if (!lis.begin(0x18))
10684
{
@@ -129,7 +107,6 @@ void setup()
129107
// we are connected
130108
Serial.println();
131109
Serial.println(io.statusText());
132-
133110
}
134111

135112
void updateTime()
@@ -147,12 +124,8 @@ void updateTime()
147124

148125
void updatePixels(uint8_t red, uint8_t green, uint8_t blue)
149126
{
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+
{
156129
strip.setPixelColor(p, red, green, blue);
157130
}
158131
strip.show();
@@ -184,13 +157,13 @@ void loop()
184157
//Serial.println("Cube TILTED: Right");
185158
cubeState = 2;
186159
}
187-
else if(event.acceleration.y < 0 && event.acceleration.y > -1)
160+
else if (event.acceleration.y < 0 && event.acceleration.y > -1)
188161
{
189162
cubeState = 3;
190163
}
191164
else
192165
{ // orientation not specified
193-
Serial.println("Cube Idle...");
166+
//Serial.println("Cube Idle...");
194167
}
195168

196169
// return if the orientation hasn't changed

0 commit comments

Comments
 (0)