I’m just getting back into using a Photon after being away for a couple of years. I seem to be getting 13 red blinks, and I can’t see why, or even a pattern as to when.
The basic idea is that an IFTTT applet publishes an event if a certain Twitter user tweets, and second IFTTT applet publishes an event if a certain hashtag is used. The Photon should light one LED for every hashtag mention and a different LED for each tweet from the user.
Each LED goes to the corresponding pin, and their grounds share a 220 ohm resistor to ground.
Troubleshooting I’ve done:
-I had a hard time flashing code, but finally figured out to install the CLI, Homebrew, and the DFU installer thing, and managed to get the firmware updated. Now I can flash the code from from web IDE, and it seems to work…until I get the SOS and 13 blinks and everything resets.
-I’ve tried different power sources for the USB cable (which is the one that came with the Photon and seems to still be good and undamaged).
-I don’t know what stack overflow means, really. I am not sending any data from the IFTTT event, and the code (which I basically copied from somebody else’s project) seems simple and small.
int hashtagLED = D2;
int tweetLED = D5;
int tweetLEDduration = 2; // in minutes
int hashtagLEDduration = 10; // in seconds
void setup(){
pinMode(tweetLED, OUTPUT);
pinMode(hashtagLED, OUTPUT);
Particle.subscribe("tweetEvent", tweetHandler, MY_DEVICES);
Particle.subscribe("hashtagEvent", hashtagHandler, MY_DEVICES);
}
void loop() {
}
void tweetHandler(const char *event, const char *data){
// If the user tweets, turn LED on
digitalWrite(tweetLED, HIGH);
// Leave it on for the length in minutes (set above) times 60000 milliseconds.
delay(tweetLEDduration * 60000);
// Turn the LED back off.
digitalWrite(tweetLED, LOW);
}
void hashtagHandler(const char *event, const char *data){
// If the hashtag is used, turn LED on.
digitalWrite(hashtagLED, HIGH);
// Leave it on for the length in seconds (set above) times 1000 milliseconds.
delay(hashtagLEDduration * 1000);
//Then we'll turn it off...
digitalWrite(hashtagLEDduration, LOW);
}
I’ve tried to search the forums and have tried a few different solutions, but not sure what to do next.
-Can the Photon not subscribe to two different events?
-Is there a problem with power consumption of the LEDs over a long (?) period of time?
-Am I missing something completely different?