Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int xpto = 0;
- byte A = 1;
- byte B = 2;
- byte C = 3;
- byte D = 4;
- int valor = 0;
- //--------------------------------------------------------
- void setup()
- {
- Serial.begin(115200);
- }
- //--------------------------------------------------------
- void loop()
- {
- valor = 0x4321;
- executa();
- valor = 0x3214;
- executa();
- Serial.println(" ");
- }
- //--------------------------------------------------------
- void executa()
- {
- for (int i = 1; i < 5; i++)
- {
- xpto = 0x000F & valor;
- valor = valor >> 4 ;
- switch (xpto)
- {
- case 1:
- Serial.println(A);
- digitalWrite(2, HIGH);
- delay(1000);
- digitalWrite(2, LOW);
- delay(1000);
- break;
- case 2:
- Serial.println(B);
- digitalWrite(3, HIGH);
- delay(1000);
- digitalWrite(3, LOW);
- delay(1000);
- break;
- case 3:
- Serial.println(C);
- digitalWrite(4, HIGH);
- delay(1000);
- digitalWrite(4, LOW);
- delay(1000);
- break;
- case 4:
- Serial.println(D);
- digitalWrite(5, HIGH);
- delay(1000);
- digitalWrite(5, LOW);
- delay(1000);
- break;
- default:
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement