Skip to content

Instantly share code, notes, and snippets.

@dmiddlecamp
Last active February 29, 2020 17:20
Show Gist options
  • Select an option

  • Save dmiddlecamp/fbfd00420a2b5e536d839c7c01aee88a to your computer and use it in GitHub Desktop.

Select an option

Save dmiddlecamp/fbfd00420a2b5e536d839c7c01aee88a to your computer and use it in GitHub Desktop.

Revisions

  1. dmiddlecamp revised this gist Apr 5, 2018. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions serial_crash.ino
    Original file line number Diff line number Diff line change
    @@ -5,8 +5,7 @@ void setup() {
    pinMode(D7, OUTPUT);

    Particle.keepAlive(1.5 * 60);
    //Serial1.begin(9600); // doesn't crash
    //Serial1.begin(9600); // crashes
    //Serial1.begin(9600); // crashes, uncomment to run normally.

    Particle.function("test", doTest);
    Particle.connect();
  2. dmiddlecamp created this gist Apr 5, 2018.
    32 changes: 32 additions & 0 deletions serial_crash.ino
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@

    bool state = false;

    void setup() {
    pinMode(D7, OUTPUT);

    Particle.keepAlive(1.5 * 60);
    //Serial1.begin(9600); // doesn't crash
    //Serial1.begin(9600); // crashes

    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);
    }