Skip to content

Instantly share code, notes, and snippets.

@nataliefreed
Created October 3, 2013 22:04
Show Gist options
  • Save nataliefreed/6817846 to your computer and use it in GitHub Desktop.
Save nataliefreed/6817846 to your computer and use it in GitHub Desktop.
/*
Natalie Freed, 10-3-2013
Example of multiple counters increasing at different rates, for LWHS Building and Programming Intelligent Machines Fall 2013.
To use, open Serial Monitor to view output.
*/
int counter1 = 0;
int counter2 = 0;
int counter3 = 0;
void setup()
{
//start serial port
Serial.begin(9600);
}
void loop()
{
Serial.print("Counter 1 is increasing very quickly: ");
Serial.println(counter1);
Serial.print("Counter 2 is increasing at a medium rate: ");
Serial.println(counter2);
Serial.print("Counter 3 is increasing slowly: ");
Serial.println(counter3);
Serial.println();
counter1 = counter1 + 10; //increase counter1 by 10
counter2 = counter2 + 5; //increase counter2 by 5
counter3 = counter3 + 1; //increase counter3 by 1
delay(500); //don't print too quickly
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment