Guest User

Untitled

a guest
Jul 19th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <Wire.h>
  2. #include "Adafruit_MCP23017.h"
  3.  
  4. Adafruit_MCP23017 mcp;
  5.  
  6. int value = 0;
  7. int total = 0;
  8.  
  9. void setup() {
  10. mcp.begin(0,D2,D1);
  11.  
  12. for (int a = 0 ; a <= 15; a++) {
  13. mcp.pinMode(a, INPUT);
  14. mcp.pullUp(a, LOW); // 100K pullup internally <- I tried commenting it out and changing it to HIGH
  15. }
  16.  
  17. }
  18.  
  19. void loop() {
  20. total = 0;
  21. for (int a = 0 ; a <= 15; a++) {
  22. value = mcp.digitalRead(a);
  23. Serial.print(value);
  24. total += value;
  25. }
  26. Serial.println();
  27. Serial.println(total);
  28. delay(200);
  29. }
Add Comment
Please, Sign In to add comment