/* Blink2 by Jared De Blander adapted from Blink by Scott Fitzgerald */ #define LED_PIN 13 // LED pin #define TIME_MS_ON 30 // LED on time #define TIME_MS_OFF 70 // LED off time #define UART_BAUD 9600 // Serial baud rate #define S_BLINK_NUM "Blink # " unsigned long blink_counter = 0; // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 as an output. pinMode(LED_PIN, OUTPUT); // turn on serial Serial.begin(UART_BAUD); } // the loop function runs over and over again forever void loop() { blink_counter++; digitalWrite(LED_PIN, HIGH); // turn the LED on (HIGH is the voltage level) Serial.print(S_BLINK_NUM); // write the blink event out of the serial port Serial.println(blink_counter); // along with the counter delay(TIME_MS_ON); // wait for the on time in milliseconds (TIME_MS_ON) digitalWrite(LED_PIN, LOW); // turn the LED off by making the voltage LOW delay(TIME_MS_OFF); // wait for the off time in milliseconds (TIME_MS_ON) }
Wednesday, June 22, 2016
Arduino Uno Blinky App with Serial Blink Counter
Tuesday, June 21, 2016
Little Arduino Test App
/* Blink2 by Jared De Blander adapted from Blink by Scott Fitzgerald */ #define TIME_MS_ON 50 #define TIME_MS_OFF 175 // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 as an output. pinMode(13, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(TIME_MS_ON); // wait for the on time in milliseconds (TIME_MS_ON) digitalWrite(13, LOW); // turn the LED off by making the voltage LOW delay(TIME_MS_OFF); // wait for the off time in milliseconds (TIME_MS_ON) }
Subscribe to:
Posts (Atom)