This code works
pinMode(led, OUTPUT);
pinMode(led2,OUTPUT);
timer.start();
}
void loop(){
digitalWrite(led,HIGH);
delay(3000);
String Temp2 = String(random(40,70));
Particle.publish("temp2", Temp2, PRIVATE);
digitalWrite(led, LOW);
delay(3000);
}
void statusUpdate(){
digitalWrite(led2,HIGH);
//Particle.publish("temp2", Temp2, PRIVATE);
delay(3000);
digitalWrite(led2,LOW);
}
This code causes a hard fault
int led = D7;
int led2 = D6;
int Temp1 = A0;
int Temp2 = A4;
short batmon = A7;
bool highwater = D0;
bool intru = D2;
Timer timer(5000, statusUpdate);
void setup()
{
pinMode(led, OUTPUT);
pinMode(led2,OUTPUT);
timer.start();
}
void loop(){
digitalWrite(led,HIGH);
delay(3000);
//String Temp2 = String(random(40,70));
//Particle.publish("temp2", Temp2, PRIVATE);
digitalWrite(led, LOW);
delay(3000);
}
void statusUpdate(){
digitalWrite(led2,HIGH);
delay(3000);
String Temp2 = String(random(40,70));
Particle.publish("temp2", Temp2, PRIVATE);
digitalWrite(led2, LOW);
delay(3000);
}