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.
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment