Advertisement
RuiViana

MPS_Shift

Jun 14th, 2016
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. byte teste = 0;
  2. byte var = 0;
  3. //-----------------------
  4. void setup()
  5. {
  6. Serial.begin(9600);
  7. pinMode(2,INPUT_PULLUP);
  8. pinMode(4,INPUT_PULLUP);
  9. pinMode(6,INPUT_PULLUP);
  10. pinMode(8,INPUT_PULLUP);
  11. }
  12. //-----------------------
  13. void loop()
  14. {
  15. escrever();
  16. }
  17. //-----------------------
  18. void escrever()
  19. {
  20. teste=digitalRead(2);
  21. teste = teste<<1;
  22. teste=teste | digitalRead(4);
  23. teste = teste<<1;
  24. teste=teste | digitalRead(6);
  25. teste = teste<<1;
  26. teste=teste | digitalRead(8);
  27. var=teste;
  28. Serial.println(var,HEX);
  29. //mySendSwitch.send(var, 24);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement