Skip to content

Instantly share code, notes, and snippets.

@lorenrogers
Created March 15, 2016 14:16
Show Gist options
  • Select an option

  • Save lorenrogers/215258b0573e3e2d46c9 to your computer and use it in GitHub Desktop.

Select an option

Save lorenrogers/215258b0573e3e2d46c9 to your computer and use it in GitHub Desktop.

Revisions

  1. Loren Rogers created this gist Mar 15, 2016.
    29 changes: 29 additions & 0 deletions max_serial_communication.pde
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    long randomvalue = 0;
    long countervalue = 0;

    int serialvalue;
    int started = 0;

    void setup()
    {
    Serial.begin(9600);
    }

    void loop()
    {
    if(Serial.available()){
    serialvalue = Serial.read();
    started = 1;
    }
    if (started) {
    randomvalue = random(1000);
    Serial.print(countervalue);
    Serial.print(" ");
    Serial.print(randomvalue);
    Serial.print(" ");
    Serial.print(serialvalue);
    Serial.println();
    countervalue = (countervalue +1) % 1000;
    delay(100);
    }
    }