// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>
//initialize the boolean variable for movement to false.
bool motion = false;
//set the speed of the lights to cycle through one
int lightSpeed = 100;
//define pin for the PIR sensor
int PIRpin = D2;
//define neopixel ring
#define PIXEL_PIN D3
#define PIXEL_COUNT 28 //bus stop #2 has 14 pixels
#define PIXEL_TYPE WS2812
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
//RGBW and CYMK colors as global variables
uint32_t w = strip.Color(255, 255, 255);// white (all on)
uint32_t r = strip.Color(255, 0, 0); // red
uint32_t y = strip.Color(255, 255, 0); // yellow
uint32_t g = strip.Color(0, 255, 0); // green
uint32_t c = strip.Color(0, 255, 255); // cyan
uint32_t b = strip.Color(0, 0, 255); // blue
uint32_t m = strip.Color(255, 0, 255); // magenta (pink/purple)
uint32_t k = strip.Color(0, 0, 0); // black (all off)
void setup()
{
/*Subscribe to a set of events published when an IFTTT widget is triggered by
a tweeting. The first one is connected to the account of a teammate for demo
purposes, the second one is connected to donaldTrump's twitter acound and the
last one is independent of a username so any other account can be used.*/
Particle.subscribe("ChenMutiatLama/2019/Group4/LamaAlFulaij", action );
Particle.subscribe("ChenMutiatLama/2019/Group4/realDonaldTrump", action );
Particle.subscribe("ChenMutiatLama/2019/Group4/tweet", action );
Particle.variable ("Motion",motion);
//PIR is readable
pinMode (PIRpin, INPUT_PULLDOWN);
//Initialize all pixels to 'off'
strip.begin();
strip.show();
}
Click to Expand
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .