Advertisement
LrdArc

intip.in/halobandung

Nov 29th, 2016
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. const byte numPins = 7;
  2. byte pins[] = {13, 14, 15, 16, 17, 18, 19};
  3. void setup() {
  4. Serial.begin(115200);
  5. }
  6.  
  7. void loop() {
  8. while(!Serial.available()); // Do nothing until serial input is received
  9. byte num = Serial.read(); // Get num from somewhere
  10. for (byte i=0; i<numPins; i++) {
  11. byte state = bitRead(num, i);
  12. digitalWrite(pins[i], state);
  13. Serial.print(state);
  14. }
  15. Serial.println();
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement