Skip to content

Instantly share code, notes, and snippets.

@dmiddlecamp
Last active February 29, 2020 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dmiddlecamp/fbfd00420a2b5e536d839c7c01aee88a to your computer and use it in GitHub Desktop.
Save dmiddlecamp/fbfd00420a2b5e536d839c7c01aee88a to your computer and use it in GitHub Desktop.
bool state = false;
void setup() {
pinMode(D7, OUTPUT);
Particle.keepAlive(1.5 * 60);
//Serial1.begin(9600); // crashes, uncomment to run normally.
Particle.function("test", doTest);
Particle.connect();
}
void loop() {
digitalWrite(D7, (state) ? HIGH : LOW);
state = !state;
Serial1.println("anything");
delay(1000);
}
int doTest(String command) {
digitalWrite(D7, (state) ? HIGH : LOW);
state = !state;
delay(250);
digitalWrite(D7, (state) ? HIGH : LOW);
state = !state;
delay(250);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment