Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include "Adafruit_MCP23017.h"
- Adafruit_MCP23017 mcp;
- int value = 0;
- int total = 0;
- void setup() {
- mcp.begin(0,D2,D1);
- for (int a = 0 ; a <= 15; a++) {
- mcp.pinMode(a, INPUT);
- mcp.pullUp(a, LOW); // 100K pullup internally <- I tried commenting it out and changing it to HIGH
- }
- }
- void loop() {
- total = 0;
- for (int a = 0 ; a <= 15; a++) {
- value = mcp.digitalRead(a);
- Serial.print(value);
- total += value;
- }
- Serial.println();
- Serial.println(total);
- delay(200);
- }
Add Comment
Please, Sign In to add comment