Skip to content
Snippets Groups Projects
Commit e07b3af9 authored by HGWcommit's avatar HGWcommit
Browse files

Create embedded_v3.ino

parent 219deeb3
No related branches found
No related tags found
No related merge requests found
Pipeline #331283 passed
/*
created 2005
by DojoDave <http://www.0j0.org>
modified 30 Aug 2011
by Tom Igoe
*/
// constants won't change. They're used here to set pin numbers:
const int buttonPin = 4; // the number of the pushbutton pin
const int ledPin = 2; // the number of the LED pin
int aux=0;
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
//aqui voy a indicar que es salida o entrada por ejemplo: Servo, LDR, LED INPUT o OUTPUT
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
//este es el ciclo, lo que se va a estar ejecutando, de arriba a abajo y vuelve a empezar
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (aux==0 & buttonState == HIGH){
// turn LED on:
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
aux++;
buttonState=0;
}
if (aux == 1 & buttonState == HIGH){
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
aux=0;
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment