/*
* LED Blink using a custom function
*
* Setup:
* Wire an LED from digital pin7 to gnd through a resistor
*/
int ledPin = 7; // Pin number attached to LED
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
blink();
}
void blink() {
Serial.println("LED on...");
digitalWrite(ledPin, HIGH); // Light the LED
delay(700);
Serial.println("Off...");
digitalWrite(ledPin, LOW); // LED off
delay(700);
}
|