Advertisement
uas_arduino

Writing 8 bits out using a byte input type

Jan 25th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.18 KB | None | 0 0
  1. void writeByte(byte data, byte[] pins){
  2.     for(byte a = 0; a < 8; a++){
  3.         if((data >> a) & 0x01){
  4.             digitalWrite(pins[a], HIGH);
  5.         }else{
  6.             digitalWrite(pins[a], LOW);
  7.         }
  8.     }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement