Steren ARD-020 Manual De Instrucciones página 46

Tarjeta programadora compatible con arduino tipo leonardo
Tabla de contenido

Publicidad

Idiomas disponibles

Idiomas disponibles

Program counter
/ * Detects if connected to the input jack 7 button has been pressed and LED
lights up
* Send the value of the variable 'Counter' account via serial port to the PC.
*
*
*/
int LED = 13;
int Button = 7;
int value = 0;
int counter = 0;
int buttonlaststate = 0;
void setup()
{
Serial.begin(9600); // Confi gures transmission speed to 9600
pinMode(LED, OUTPUT); // Initializes as a digital output pin 13
pinMode(Boton, INPUT); // initializes as a digital input the 7
digitalWrite(Boton,HIGH); // Enable internal resistance Pull-up from PIN7
}
void loop()
{
value = digitalRead(Boton); // Reads the digital input pin 7 value
digitalWrite(LED, !valor); // Write in the output the read denied value
if(value != int buttonlaststate){
if(value == 1){
counter++;
14
14

Publicidad

Tabla de contenido
loading

Tabla de contenido