Exemple 2.1.
/*
* _2.1_blink
*
* The on-board LED blinks with a 2 second interval,
* being turned on for 1 second and then turned off for 1 second.
*
* (c) 2013-2016 Arduino LLC.
*/
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
Exemple 2.2.
/*
* _2.2_blink
*
* An external LED blinks with a 2 second interval,
* being turned on for 1 second and then turned off for 1 second.
*
* (c) 2013-2016 Arduino LLC.
*/
void setup() {
pinMode(5, OUTPUT);
}
void loop() {
digitalWrite(5, HIGH);
delay(1000);
digitalWrite(5, LOW);
delay(1000);
}
Exemple 2.3.
/*
* _2.3_blink
*
* An external LED blinks with a 2 second interval,
* being turned on for 1 second and then turned off for 1 second.
*
* The variable ledPin is declared to hold the value 5, the number
* of the digital pin you are using.
*
* (c) 2013-2016 Arduino LLC.
*/
int ledPin = 5;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}
Cap comentari:
Publica un comentari a l'entrada