blob: 98d36b828e1f2488857039b13bfb07f62f628640 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/** Inputs.ino
* Sets port 7 on bank B to INPUT_PULLUP and copies its
* state to the built-in LED on the board
* https://github.com/ndomx/MCP23017-Arduino-Library
*/
#include <mcp23017.h>
#define MCP_ADDR (0)
MCP23017 mcp(MCP_ADDR);
void setup(void){
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
mcp.start();
mcp.pinMode(GPB7, INPUT_PULLUP);
}
void loop(void){
byte mcp_input = mcp.digitalRead(GPB7);
digitalWrite(LED_BUILTIN, mcp_input);
Serial.println(mcp_input);
delay(500);
}
|