Breathing cyan for 1 min then switch over to breathe green help

Hey guys I am in a predicament that I can’t figure out nor can I find a full solution on this forum or anywhere else

when I flash my particle board it flashes fine, restarts blinks green, connects to wifi then breaths cyan. great exactly what it should do. after one minute it flips over to breathing green and I can’t figure out why. to get it to flash again I put it in safe mode, flashes fine and does the same thing over and over. I am out of ideas of what to try It doens’t matter what program i try it does the same thing. I have 2 photons that do the same exact thing

here is a list of what I have tried open to other suggestions. Also here is the program I want to run

https://community.particle.io/t/familamp-cloud-synchronized-color-selectable-lamps/?source_topic_id=29246
with this program if i continually touch the touch sensor it will stay blue for longer than one minute and it will continue to send data like its supposed to. I can track it via the logs on the council. it does send color data. After I stop touching it, it will eventually flip to green and stay there till i either restart it. or I touch the sensor a few times and it will come alive again to breathe blue but it will not send any data to the council after this nor is there any reporting that it is active.

I have flashed latest firmware .0.6.0 onto both of them , confirmed it has it via the web interface.

I have attached an external antenna to them to make sure they have enough wifi signal.
I have moved them closer to the wireless.
i have used a secondary access point
i have used a different wifi name and combination of wifi passwords
I have used a different subnet for wifi
I have unclaimed and reclaimed them
I have put them on multiple known good USB power packs.
I have tried them in my usb computer sockets
I have removed all wires except the usb to power it just to make sure it was not interfering
I have updated my cli on my computer to aid in the process.
I have double checked the code

I am thoroughly out of ideas and I am welcome to hear any and I am willing to try any. I have looked up and down the different codes on of breathing

hopefully i am missing something stupid
ANY suggestions at all?

my devices never used to do this till about 2 weeks ago. I purchased them maybe 2 years ago did a little tinkering with them, forgot about them. Found the above project and started working on it and this started

Breathing green indicates that you’ve lost the cloud connection (most likely due to blocking code). Try flashing Tinker while in Safe Mode, and see if that makes a difference.

can you elaborate on blocking code? maybe i can fix the program code in the link i provided.
I will try the tinker

That’s not actually a link to the code.
Where exactly is the code?

Add SYSTEM_THREAD(ENABLED) to your project and the breathing green should go away.
The program may still not work, but the cloud connection should stay alive.

sorry that’s my bad, that was a link to the project sorta giving background into what I am trying to do
here is the code on github
I will add SYSTEM_THREAD(ENABLED) now :smile:

https://github.com/Here-Be-Dragons/familamp/blob/master/familamp.ino

To Moors7 clearly my other programs suck as well lol because the tinker is going like a champ and not dropping wifi. Will do what ScruffR suggested

Well, the photon is staying connected now but as you said my program might not work.
It is sort of working… when I touch the sensor it changes the color like it should on the neopixel 16 ring but from what i see in the console it never publishes any event related to color

Do you have suggestions for your conveince i had put the code here

#include "application.h"
#include "captouch.h"
#include "neopixel/neopixel.h"
SYSTEM_THREAD(ENABLED)
SYSTEM_MODE(AUTOMATIC);

//PRODUCT_ID and PRODUCT_VERSION required for Particle's "Products" feature
PRODUCT_ID(639);
PRODUCT_VERSION(13);

CapTouch Touch(D3, D4);

#define PIXEL_COUNT 60
#define PIXEL_PIN D2
#define PIXEL_TYPE WS2812

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

////
// User Variables
////

uint32_t decayTime = 2835;                  // Start dimming light after elapsed seconds
uint32_t decayDelay = 3;                    // Seconds between decay fade-out steps
uint8_t nightHours[2] = {6,      21};       // Night mode starts at nightHours[1], ends at nightHours[0]
uint8_t duskHours[2] =  {  7,  19  };       // Dusk mode starts at duskHours[1], ends at duskHours[0].  Needs to be inside nightHours' times.
// Day mode starts at duskHours[0], ends at duskHours[1]
uint16_t maxDayBrightness = 180;            // 0 - 255, lamp will not exceed this during the day
uint16_t maxDuskBrightness = 70;            // 0 - 255, lamp will not exceed this during dusk
uint16_t maxNightBrightness = 20;           // 0 - 255, lamp will not exceed this during the night
float fadeRate = 0.95;                      // Fireworks Variable: 0.01-0.99, controls decay speed

////
// End User Variables
////

double lastColorUpdate = 0;                 // Epoch of last color update (local or remote)
String colorFromID;                         // String, Tracks who sent the color (for debug)
uint16_t colorRecieved;                     // 0 - 255, Tracks the color received from another lamp
bool lampOn = 0;                            // Tracks if the lamp is lit
uint8_t activeColor = 0;                    // 0 - 255, Tracks what color is currently active (start at red)
uint8_t activeR = 255;                      // 0 - 255, Red component of activeColor;
uint8_t activeG = 0;                        // 0 - 255, Green component of activeColor;
uint8_t activeB = 0;                        // 0 - 255, Blue component of activeColor;
double lastDecayDelay = 0;                  // Time Tracker for decayDelay
uint16_t lampBrightness = 0;                // 0 - 255, Tracks current lamp brightness
uint16_t maxBrightness = maxDayBrightness;  // Assigned the current max brightness
uint8_t dayTrack = 0;                       // Track day/dusk/night condition
uint8_t fadeColor = 0;                      // Track color for special events
byte activePixels = 0;                      // Tracks number of active pixels, 0 is first pixel
float redStates[PIXEL_COUNT];               // Fireworks Variable
float blueStates[PIXEL_COUNT];              // Fireworks Variable
float greenStates[PIXEL_COUNT];             // Fireworks Variable
uint8_t heartbeatDirector = 0;              // Heartbeat Tracking
uint8_t heartbeatColor = 0;                 // Heartbeat Tracking
CapTouch::Event touchEvent;

void setup() {
  strip.begin();
  strip.show();
  rainbowFull(5, 0); // 5ms Delay, 0 is fade in
  rainbowFull(5, 2); // 5ms Delay, 2 is fade out

  Touch.setup();

  Time.zone(-5);
  //Listen for other lamps to send a particle.publish()
  Particle.subscribe("FamiLamp_Update", gotColorUpdate, MY_DEVICES);
}

void loop() {
  dayTracking();
  touchEvent = Touch.getEvent();

  if (touchEvent == CapTouch::TouchEvent) {
    whileTouching();
  }
  if (Time.now() - lastColorUpdate > decayTime && lampOn == 1) {
    if (Time.now() - lastDecayDelay >= decayDelay) {
      extinguish();
      lastDecayDelay = Time.now();
    }
  }

  // Special idle functions
  if (lampOn == 0) {
    // Christmas Day
    if (Time.day() == 25 && Time.month() == 12) {
      idleColorFader(0, 85);
    }
    // St. Patricks Day
    if (Time.day() == 17 && Time.month() == 3) {
      idleColorFlicker(21);
    }
    // Valentines Day
    if (Time.day() == 14 && Time.month() == 2) {
      idleColorFlicker(106);
    }
    // 4th of July
    if ( Time.day() == 4 && Time.month() == 7 ) {
      idleFireworks(0);
    }
    // New Years Day
    if ( Time.day() == 1 && Time.month() == 1 ) {
      idleFireworks(1);
    }
    // Birthdays
    if (
      (Time.day() == 22 && Time.month() == 2) ||
      (Time.day() == 24 && Time.month() == 2)
    ) {
      idleDisco();
    }
    // Unassigned Heartbeat
    /*if (Time.day() == 25 && Time.month() == 1) {
        idleHeartbeat();
      }*/
    // Clear any previous day's special idles
    if (lampBrightness != 0 && Time.hour() == 0 && Time.minute() == 0 && Time.second() <= 3) {
      for (uint16_t i = 0; i < strip.numPixels(); i++) {
        strip.setPixelColor(i, 0, 0, 0);
      }
      strip.show();
      lampBrightness = 0;
    }
  }
}

void whileTouching() {
  byte previousBrightness = lampBrightness; // Store the previous brightness in case we need it later
  uint16_t pixelBrightness = lampBrightness; // Tracks the given pixel's brightness.  Needs to track > 255, so uint16_t
  uint8_t testColor = activeColor; // Start with the current color
  activePixels = 0;
  while (touchEvent != CapTouch::ReleaseEvent) {
    for (byte i = 0; i <= activePixels; i++) {
      pixelBrightness = lampBrightness + i; //Fade to full brightness
      if (pixelBrightness > maxBrightness) pixelBrightness = maxBrightness; //catch overflow
      // "activePixels - i" reverses the direction
      strip.setPixelColor(activePixels - i, wheelColor(((i * 60 / strip.numPixels()) + testColor) & 255, pixelBrightness)); // "& 255" AKA bitwise and prevents overflow
    }
    strip.show();
    testColor++; //because testColor is uint8_t, automatically loops at 256
    if (activePixels < (strip.numPixels() - 1)) activePixels++; //Add 1 for next iteration, but prevent looping around
    if (lampBrightness < maxBrightness) lampBrightness++;
    touchEvent = Touch.getEvent();
    delay(3);
  }
  if (activePixels >= (strip.numPixels() - 10)) {
    lampOn = 1;
    activeColor = testColor;
    sendColorUpdate();
    lastColorUpdate = Time.now();
  } else {
    lampBrightness = previousBrightness;
    setColor(activeColor);
  }
}

void sendColorUpdate() {
  String sColor = String(activeColor);
  Particle.publish("FamiLamp_Update", System.deviceID() + "~" + sColor, 60, PRIVATE);
}

void gotColorUpdate(const char *name, const char *data) {

  String str = String(data);
  char strBuffer[40] = "";
  str.toCharArray(strBuffer, 40);
  colorFromID = strtok(strBuffer, "~");
  colorRecieved = atof(strtok(NULL, "~"));
  lampBrightness = maxBrightness;
  setColor(colorRecieved);
  // DEBUG
  String sColorRecieved = String(colorRecieved);
  Particle.publish("Color_Recieved", System.deviceID() + "~" + sColorRecieved);
  // END DEBUG
  lampOn = 1;
  lastColorUpdate = Time.now();
}

void setColorOld(byte c, byte ) { // c is color.  This function does a smooth fade new color.  Deprecated for new setColor()
  if (((Time.month() * Time.day()) % 256) == c) { // Semi-random formula to trigger easter egg
    rainbowEasterEgg();
  } else {
    uint8_t newR, newG, newB, startR, startG, startB, endR, endG, endB;
    uint32_t color = wheelColor(c, lampBrightness);
    endR = (uint8_t)((color >> 16) & 0xff); // Splits out new color into separate R, G, B
    endG = (uint8_t)((color >> 8) & 0xff);
    endB = (uint8_t)(color & 0xff);
    for (uint16_t fade = 0; fade < 255; fade++) {
      for (uint16_t j = 0; j < strip.numPixels(); j++) {
        long startRGB = strip.getPixelColor(j); // Get pixel's current color
        startR = (uint8_t)((startRGB >> 16) & 0xff); // Splits out current color into separate R, G, B
        startG = (uint8_t)((startRGB >> 8) & 0xff);
        startB = (uint8_t)(startRGB & 0xff);
        newR = startR + (endR - startR) * fade / 255; // Color mixer
        newG = startG + (endG - startG) * fade / 255;
        newB = startB + (endB - startB) * fade / 255;
        strip.setPixelColor(j, newR, newG, newB);
      }
      strip.show();
      delay(10);
    }
  }
  activeColor = c;
}

void setColor(byte c) { // c is color.  This function does a "random dither" to set the new color
  if (((Time.month() * Time.day()) % 256) == c) { // Semi-random formula to trigger easter egg
    rainbowEasterEgg();
  } else {
    // Determine highest bit needed to represent pixel index
    uint32_t color = wheelColor(c, lampBrightness);
    int hiBit = 0;
    int n = strip.numPixels() - 1;
    for (int bit = 1; bit < 0x8000; bit <<= 1) {
      if (n & bit) hiBit = bit;
    }

    int bit, reverse;
    for (int i = 0; i < (hiBit << 1); i++) {
      // Reverse the bits in i to create ordered dither:
      reverse = 0;
      for (bit = 1; bit <= hiBit; bit <<= 1) {
        reverse <<= 1;
        if (i & bit) reverse |= 1;
      }
      strip.setPixelColor(reverse, color);
      strip.show();
      delay(20);
    }
  }
  activeColor = c;
}

void extinguish() { //Dims the lamp by one unit until lampBrightness is 0 and lampOn is 0
  lampBrightness--;
  uint32_t color = wheelColor(activeColor, lampBrightness);
  for (byte j = 0; j <= strip.numPixels(); j++) {
    strip.setPixelColor(j, color);
  }
  strip.show();
  if (lampBrightness <= 0) {
    lampOn = 0; //If the lamp is completely off, set lampOn to 0
    lampBrightness = 0; // Make sure this number isn't negative somehow
  }
}

uint32_t wheelColor(uint16_t WheelPos, uint16_t iBrightness) {
  float R, G, B;
  float brightness = iBrightness / 255.0;

  if (WheelPos < 85) {
    R = WheelPos * 3;
    G = 255 - WheelPos * 3;
    B = 0;
  } else if (WheelPos < 170) {
    WheelPos -= 85;
    R = 255 - WheelPos * 3;
    G = 0;
    B = WheelPos * 3;
  } else {
    WheelPos -= 170;
    R = 0;
    G = WheelPos * 3;
    B = 255 - WheelPos * 3;
  }
  activeR = R * brightness;// + .5;
  activeG = G * brightness;// + .5;
  activeB = B * brightness;// + .5;
  return strip.Color((byte) activeR, (byte) activeG, (byte) activeB);
}

void rainbowFull(byte wait, byte fade) {
  uint16_t i, j, k;
  if (fade == 0) k = 0;
  else k = maxBrightness;

  for (j = 0; j <= 255; j++) {
    for (i = 0; i < strip.numPixels(); i++) {
      strip.setPixelColor((strip.numPixels() - 1) - i, wheelColor(((i * 60 / strip.numPixels()) + j) & 255, k));
    }
    strip.show();
    delay(wait);
    if (fade == 0 && k < maxBrightness) {
      k++;
    }
    if (fade == 2 && k > 0) {
      k--;
    }
  }
}

void rainbowEasterEgg() {
  for (uint8_t i = 0; i <= strip.numPixels(); i++) {
    strip.setPixelColor(i, wheelColor((i * 256 / strip.numPixels()) & 255, lampBrightness));
  }
  strip.show();
}

void dayTracking() {
  if (Time.hour() < nightHours[0] || Time.hour() >= nightHours[1]) { // Night hours
    if (dayTrack != 2) {
      maxBrightness = maxNightBrightness;
      if (lampBrightness > maxBrightness) lampBrightness = maxBrightness;
      setColor(activeColor);
      dayTrack = 2;
    }
  } else if (Time.hour() < duskHours[0] || Time.hour() >= duskHours[1]) { // Dusk hours
    if (dayTrack != 1) {
      maxBrightness = maxDuskBrightness;
      if (lampBrightness > maxBrightness) lampBrightness = maxBrightness;
      setColor(activeColor);
      dayTrack = 1;
    }
  } else { // Everything else is day
    if (dayTrack != 0) {
      maxBrightness = maxDayBrightness;
      if (lampBrightness > maxBrightness) lampBrightness = maxBrightness;
      setColor(activeColor);
      dayTrack = 0;
    }
  }
}

void idleColorFader(uint8_t c1, uint8_t c2) {
  lampBrightness = 40;
  if ( maxBrightness < lampBrightness ) {
    lampBrightness = maxBrightness;
  }
  uint16_t currR, currG, currB, endR, endG, endB;
  uint32_t color = wheelColor(fadeColor, lampBrightness);
  endR = (uint16_t)((color >> 16) & 0xff); // Splits out new color into separate R, G, B
  endG = (uint16_t)((color >> 8) & 0xff);
  endB = (uint16_t)(color & 0xff);
  for (uint16_t j = 0; j < activePixels; j++) {
    long startRGB = strip.getPixelColor(j); // Get pixel's current color
    currR = (uint16_t)((startRGB >> 16) & 0xff); // Splits out current color into separate R, G, B
    currG = (uint16_t)((startRGB >> 8) & 0xff);
    currB = (uint16_t)(startRGB & 0xff);
    if ( currR > endR ) {
      currR = currR - 1;
    } else if ( currR < endR ) {
      currR = currR + 1;
    } else {
      currR = endR;
    }
    if ( currG > endG ) {
      currG = currG - 1;
    } else if ( currG < endG ) {
      currG = currG + 1;
    } else {
      currG = endG;
    }
    if ( currB > endB ) {
      currB = currB - 1;
    } else if ( currB < endB ) {
      currB = currB + 1;
    } else {
      currB = endB;
    }

    //Catch overflows
    currR %= 255;
    currG %= 255;
    currB %= 255;

    strip.setPixelColor(j, currR, currG, currB);
    if ( j >= strip.numPixels() - 1 && endR == currR && endG == currG && endB == currB) {
      if ( fadeColor == c1 ) {
        fadeColor = c2;
      } else {
        fadeColor = c1;
      }
      activePixels = 0;
    }
  }
  strip.show();
  if ( activePixels < strip.numPixels() ) activePixels++;
  delay(20);
}

void idleFireworks(uint8_t w) {
  // w = 0 for mulitcolor, w = 1 for all white flashes
  lampBrightness = 40;
  if ( maxBrightness < lampBrightness ) {
    lampBrightness = maxBrightness;
  }
  if (random(20) == 1) {
    uint16_t i = random(strip.numPixels());
    if (redStates[i] < 1 && greenStates[i] < 1 && blueStates[i] < 1) {
      if (w == 0) {
        redStates[i] = random(lampBrightness);
        greenStates[i] = random(lampBrightness);
        blueStates[i] = random(lampBrightness);
      } else {
        redStates[i] = lampBrightness;
        greenStates[i] = lampBrightness;
        blueStates[i] = lampBrightness;
      }
    }
  }
  for (uint16_t l = 0; l < strip.numPixels(); l++) {
    if (redStates[l] > 1 || greenStates[l] > 1 || blueStates[l] > 1) {
      strip.setPixelColor(l, redStates[l], greenStates[l], blueStates[l]);
      if (redStates[l] > 1) {
        redStates[l] = redStates[l] * fadeRate;
      } else {
        redStates[l] = 0;
      }

      if (greenStates[l] > 1) {
        greenStates[l] = greenStates[l] * fadeRate;
      } else {
        greenStates[l] = 0;
      }

      if (blueStates[l] > 1) {
        blueStates[l] = blueStates[l] * fadeRate;
      } else {
        blueStates[l] = 0;
      }

    } else {
      strip.setPixelColor(l, 0, 0, 0);
    }
  }
  strip.show();
}
void idleDisco() {
  lampBrightness = 20;
  if ( maxBrightness < lampBrightness ) {
    lampBrightness = maxBrightness;
  }
  for (int i = 0; i < strip.numPixels(); i++) {
    int randr = random(0, lampBrightness);
    int randg = random(0, lampBrightness);
    int randb = random(0, lampBrightness);
    int randi = random(0, (strip.numPixels() - 1));
    strip.setPixelColor(randi, randr, randg, randb);
    strip.show();
    delay(5);
  }
}
void idleColorFlicker(uint8_t c) {
  lampBrightness = 20;
  if ( maxBrightness < lampBrightness ) {
    lampBrightness = maxBrightness;
  }
  uint32_t color = wheelColor(c, lampBrightness);

  for (uint8_t i = 0; i < strip.numPixels(); i++) {
    uint8_t flicker = random(0, 10);
    int flickerR = (uint16_t)((color >> 16) & 0xff) - flicker; // Splits out new color into separate R, G, B
    int flickerG = (uint16_t)((color >> 8) & 0xff) - flicker;
    int flickerB = (uint16_t)(color & 0xff) - flicker;
    if (flickerR < 0) flickerR = 0;
    if (flickerG < 0) flickerG = 0;
    if (flickerB < 0) flickerB = 0;
    strip.setPixelColor(i, flickerR, flickerG, flickerB);
  }
  strip.show();
  delay(30);
}
void idleHeartbeat() {
  lampBrightness = 20;
  if ( maxBrightness < lampBrightness ) {
    lampBrightness = maxBrightness;
  }
  uint8_t endColor = 0;

  if ( heartbeatDirector == 0 ) {
    endColor = lampBrightness * 0.6;
  } else if ( heartbeatDirector == 1 ) {
    endColor = lampBrightness * 0.2;
  } else if ( heartbeatDirector == 2 ) {
    endColor = lampBrightness;
  } else if ( heartbeatDirector == 3 ) {
    endColor = lampBrightness * 0.12;
  } else {
    //do nothing, this will delay
  }

  if ( heartbeatColor < endColor ) {
    for (int j = heartbeatColor; j < endColor; j += 4) {
      for (int i = 25; i < 35; i++) {
        strip.setPixelColor(i, j, 0, 0);

      }
      strip.show();
      delay(15);
    }
  } else if ( heartbeatColor > endColor ) {
    for (int j = heartbeatColor; j > endColor; j--) {
      for (int i = 25; i < 35; i++) {
        strip.setPixelColor(i, j, 0, 0);

      }
      strip.show();
      delay(30);
    }
  } else {
    delay(15);
    delay(15);
    delay(15);
    delay(15);
    delay(15);
    delay(15);
    delay(15);
  }

  heartbeatColor = endColor;

  heartbeatDirector++;
  heartbeatDirector %= 4;
}

Have a look at the publish rate limits, and make sure you’re not exceeding those.

Your Particle.publish name is too long. The max is 12 characters long.

@ric i was looking at the documentation and it looks fine to me as it was working earlier. I could see events being published such as color_updated

has the documentation changed? here is what I see as of today
"name (1–63 ASCII characters)"

@Moors7 yeah i remember reading about those pretty sure i am not exceeding it as an event is published only when the button is touched. its 1 per second right? with up to 4 per second then you have to wait an additional time before you can publish again

Oops, you’re right. It’s Particle.function that can only have a 12 letter name.

Expecting you are already using 0.6.0 firmware:
You may want to add some Log.info() statements in your code to get a feeling which functions are called and whether they are left as expected too.
The syntax for the log messages is the same as for printf() so you can even log values of interesting variables.
To get the log messages out via USB Serial, you need to add this line to the top of your code

SerialLogHandler logHandler;

BTW, what’s the use of this :confused:

  ...
  } else {
    delay(15);
    delay(15);
    delay(15);
    delay(15);
    delay(15);
    delay(15);
    delay(15);
  }

Since you have set this

//PRODUCT_ID and PRODUCT_VERSION required for Particle's "Products" feature
PRODUCT_ID(639);
PRODUCT_VERSION(13);

Your rate limit will be lower than 1/sec.
https://www.particle.io/pricing

Assuming you are in the Prototype (free) tier you’ll have 250K/month and if that is broken down over the month that would be a bit less than 1/10sec.

I’m also not sure how the event routing works for products. Try adding a Particle.function() to trigger a Particle.publish() and see if that hits your console.

Is 639 really your own Product ID that you see in your product console?

@ScruffR
yes I am on .0.6.0

I will add this to start with. ill see how to add this stuff

haha actually i have not noticed the delay(15)
The guy’s project looks to still be a WIP however by the pictures he has, he has it working with the exact code he uploaded yesterday which is what you see above.
Each of those functions do different light effects with neopixels. Currently as I am troubleshooting it. I have commented out all the excess functions in the loop()
so all i have is this currently. I may just remove all of it. however what I dont get is he has his working and following the instructions mine doesnt :frowning: even with the code he just uploaded as I mentioned previously :stuck_out_tongue: :smile:

void loop() {
   
    dayTracking();
    touchEvent = Touch.getEvent();

    if (touchEvent == CapTouch::TouchEvent) {
		whileTouching();
	}
    if (Time.now() - lastColorUpdate > decayTime && lampOn == 1) {
        if (Time.now() - lastDecayDelay >= decayDelay) {
            extinguish();
            lastDecayDelay = Time.now();
        }
    }
    }

//PRODUCT_ID and PRODUCT_VERSION required for Particle’s “Products” feature
PRODUCT_ID(639);
PRODUCT_VERSION(13);
yes you are right I was on that soley becuase he had it in there. I can remove this as need be but the update to the particle.publish should only be from my little understanding when i touch the button it publishes a new even and all the other photons that are subscribed listen in and boom they all change to it

Rather than blindly copying other people’s code, you’d do well to give it a shot yourself. That way you’ll get to understand the basics and allow you to spot potential issues more quickly and on your own. Dumping someone else’s code on here and expecting others to fix it to make it work with your project isn’t really the idea behind this forum.

Because his code is written for his specific devices. Blindly copying it doesn’t ensure that it’ll work on yours as well.

Again, don’t just copy things for the sake of it. Make sure you understand why it’s in there, and what it does.

The way I see it is that it publishes as long as the things is touched. It’s in a loop, and it publishes every time it checks for touch. Seeing as the loop is ridiculously fast, that can be a couple of times a second, immediately blowing the limit.

Again, try it for yourself with the simplest code you can think of. Have it check for a button/touch, and when activated, send an event. On the receiving end, listen for that event, and make it light up. That’s basically all this project is. Everything else is just to make it fancy…

@Moors7 I respectfully disagree. i have been giving it a shot myself. I have been trying to debug this code for the past 2 days on this project without posting anything and only googling. prior to that there was another open source project exactly like this that a guy had abandon and i was trying to get that to work for the past 1.5 months. I never asked anyone to completely fix the project and you guys have already given me a ton of help with the logging options, which i will be doing. If I wanted someone to fix it, I would just pay someone on the forum or another coding forum to fix it for me or actually go out and buy this actual existing product already which i have contemplated doing as this guy got it from another open source guy that turned it into a commercial product.

I personally learn best by examples as I am a visual learning, and since I literally can’t touch code this is the best i got. What I usually do for past projects it copy an existing idea and modify it the way i want. I am more of a hardware guy anyway. this is one of the few projects i actually post about most of them i figure out with googling. I do whole home automation with ESP8266 chips and i am working on a tix clock design, through hardware, software and 3d modeling of my printer, i am well equipped for troubleshooting but if google doesn’t help which in this case it didn’t

I have already contact the creator and mentioned to him a few } errors that he was missing, before i posted on here.

wrong, based on his how to this is generic code that could be even ported over to an ESP8266 (which he has mentioned) which eventually i will be doing because they are 20x cheaper than these photons. The only things that would have to change is the publish and subscribe which I would change to an mqtt function if I ported to an ESP8266

and he hasn’t written it specifically for his devices, his device is the same as my device. I have already changed all the variables to mine. you do not see the PRODUCT_ID of mine because particle website says to keep it safe. that was based on his example and I am not posting mine

2 Likes

Sorry if I came off too negative, that was not the intention. I have noticed your posts in the other topics as well.

The “don’t just copy code without checking it”, comes from the fact that you mentioned you hadn’t seen the delay(15)'s, and the fact that you stuck those bits of product code in there (assuming your device is not part of a product). That’s also why I mentioned his code was specific to his devices, since that product ID links those devices to a certain product. If you add that to your code without doing anything with products, that might cause issues.

That’d be the Filimin guys, who previously used a Photon. I liked their project, so made a version of my own as well. Having made this project from scratch, I can assure you it’s not too hard if you try it yourself.

The very basics are nothing more than input -> publish -> subscription -> output. Anything else is just for show.

Unless you want to do some fancy multi-device piece of code, don’t overcomplicate things like timezones and deviceIDs. Either hard-code them, or use a function to change it remotely. That will make life much more easy than trying to figure out a generic solution.

1 Like

For debugging purposes, I’d suggest to get the code working before setting the PRODUCT_ID().
Only once you have got it running as expected, transition to a product and deal with the extra issues that may pop up (e.g. differences in rate limits and event routing).
That way you know the code is working but the rules of the game have changed.
With your aproach you now have to figure if it’s the code or a device vs. product issue in one go.
That’s like solving an undeedetermined system of equations - you need more input.

1 Like

ah ha! i sorta figured it out, i reverted back to the original code and now its not doing the breathe cyan then flip to green.
I am powering it via the 5v rail on the unit and not using usb. that is literally the only change i have done. has anybody else experienced this issue? or why do you think it’d be causing that?
I guess in the end it doesn’t really matter as I will be powering it via a wall plug anyway

However as mentioned i believe, it is stuck in the loop of whiletouching(). Once i touch the sensor does a rainbow effect and continues till the end of time. will continue to debug