[go: up one dir, main page]

0% found this document useful (0 votes)
13 views2 pages

Cordigoarduinocase

Uploaded by

Lopez Fer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Cordigoarduinocase

Uploaded by

Lopez Fer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#define sw1 10

#define sw2 11
#define sw3 12
#define pin7 7
#define pin6 6
#define pin5 5
#define pin4 4
#define pin3 3
#define pin2 2
#define pin1 1
#define pin0 0

bool ;
int bin;

void setup()
{
Serial.begin(9600);
pinMode(sw1, INPUT);
pinMode(sw2, INPUT);
pinMode(sw3, INPUT);
pinMode(pin7, OUTPUT);
pinMode(pin6, OUTPUT);
pinMode(pin5, OUTPUT);
pinMode(pin4, OUTPUT);
pinMode(pin3, OUTPUT);
pinMode(pin2, OUTPUT);
pinMode(pin1, OUTPUT);
pinMode(pin0, OUTPUT);
}

void loop()
{
int tecla1 = digitalRead(sw1);
int tecla2 = digitalRead(sw2);
int tecla3 = digitalRead(sw3);
bin = (tecla1 << 2) | (tecla2 << 1) | tecla3;

-------------------------------------------------------------------------
switch(bin)
{
case 0:
f = 1;
digitalWrite(pin7, HIGH);
Serial.print("Salida: ");
Serial.print(f);
break;

case 1:
f = 0;
digit1alWrite(pin6, LOW);
Serial.print("Salida: ");
Serial.print(f);
break;

case 2:
f = 1;
Serial.print("Salida: ");
Serial.print(f);
digitalWrite(pin5, HIGH);
break;

case 3:
f = 1;
Serial.print("Salida: ");
Serial.print(f);
digitalWrite(pin4, HIGH);
break;

case 4:
f = 0;
Serial.print("Salida: ");
Serial.print(f);
digitalWrite(pin3, LOW);
break;

case 5:
f = 0;
Serial.print("Salida: ");
Serial.print(f);
digitalWrite(pin2, LOW);
break;

case 6:
f = 1;
Serial.print("Salida: ");
Serial.print(f);
digitalWrite(pin1, HIGH);
break;

case 7:
f = 1;
Serial.print("Salida: ");
Serial.print(f);
digitalWrite(pin0, HIGH);
break;
}
}

You might also like