So I took @Moors7 suggestion and rewrote my code. Here is the working product. Interesting when using IFTTT, I switched back and forth between a few of my students particle logins and I had to set my Particle.subscribe to public (by removing , MY_DEVICES) even though I was correctly logged into IFTTT and particle as one of my students trying to access the students photon. Almost as if IFTTT had remembered my first particle login so when I cleared that and logged in as a student to particle from within IFTTT, IFTTT thought I did not have access to the new photon. My suggestion is that, if you have problems with subscribe is to start with public and then work towards making things private.
Most people can start with private since they will not be switching back and forth between logins like I was doing.
//PUT YOUR GLOBAL VARIABLES HERE
volatile bool myFlag1 = false;
int myCount = 0;
Timer myTimer1(7000, my7sFunction); // activate function every 7 seconds
void my7sFunction(){
myFlag1 = true;
}
// Any general setup stuff goes here
void setup(){
pinMode(D0, OUTPUT);
pinMode(D7, OUTPUT);
myTimer1.start();
Particle.subscribe("my-lamp-on", myLampFunction); //, MY_DEVICES
// for using the "DO" IFTTT button or the "IF" this then that
// must remove ", MY_DEVICES" for Public anyone to access
}
void myLampFunction(const char *event, const char *data){
digitalWrite(D0, 1); // flash D0 for 2 seconds
delay(2000);
digitalWrite(D0, 0); // D0 Off
}
void loop(){
// your looping stuff goes here
if (myFlag1){
myCount++; // not really used, but good to keep count
digitalWrite(D7, 1); // turn D7 on
delay(20);
if (analogRead(A0) >= 1000){
Particle.publish("bright-light", "1000", 60, PRIVATE);
}
if (analogRead(A0) <= 30){
Particle.publish("no-light", "30", 60, PRIVATE);
}
digitalWrite(D7, 0); // turn D7 off
myFlag1 = false; // reset timer variable
}
}