Relay Status to Web App

Hi all,

I’ve been working on this project for the past few weeks ( and the original developer set it up to post the status of a bathroom door to a web app. I’ve copied everything directly to the T but I’m unable to get the web app working properly. I’ve added in my own device’s ID and access code but I’m still running into issues.

Anyone familiar with publishing one of the known variables to a web app? In all honesty, I just need a page to be red or green depending on one of the variables.

Here is my code:

// This #include statement was automatically added by the Particle IDE.
#include "neopixel/neopixel.h"

#define PIN 9
#define PIXEL_PIN D2
#define PIXEL_COUNT 12
#define PIXEL_TYPE WS2812B

int analogPin = A0;
int val;
int bathStatus;
int reedSense;
bool isClosed;

// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel.  Avoid connecting
// on a live circuit...if you must, connect GND first.

void setup() {
  strip.begin();; // Initialize all pixels to 'off'
  Particle.variable("bathStatus", &bathStatus, INT);
  Particle.variable("reedSense", &reedSense, INT);

void loop() {

    val = digitalRead(analogPin);
    reedSense = val;
    if (bathStatus = 1) {
        if (!isClosed) {
            isClosed = true;
    } else {
        if (isClosed) {
            isClosed = false;
    if (val >= 1) {
        bathStatus = 1;
    } else {
        bathStatus = 0;

void canpoop() {
  colorWipe(strip.Color(0, 255, 0), 50); // Green;

void cantpoop() {
  colorWipe(strip.Color(255, 0, 0), 50); // Red;

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);;

Thanks all!

Can you see the correct status with this page? (for the variables) (for the publishes)

If so, then posting the firmware code does help little. But the “web app” might need to be shown and some more info of what is not working.

But you still seem to be missing pinMode(analogPin, INPUT); (which should also have a pull-resistor) in setup().

Yup this is what I see on the interface page:

And on the log page:

The entire web app repo is here: