blob: f99065ac5937dcc798f1aa385f753524c06c6539 (
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
27
28
|
/** 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);
}
|