Created
March 7, 2017 18:33
-
-
Save HON95/5a06355b4e9e20f9ec065ab1dd4351dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Pinout: | |
Connect pin #1 of the expander to Analog 5 (i2c clock) | |
Connect pin #2 of the expander to Analog 4 (i2c data) | |
Connect pins #3, 4 and 5 of the expander to ground (address selection) | |
Connect pin #6 and 18 of the expander to 5V (power and reset disable) | |
Connect pin #9 of the expander to ground (common ground) | |
*/ | |
#include <Wire.h> | |
#include <Adafruit_MCP23008.h> // From plab-libraries | |
#define PIN_EXPANDER_ADDRESS 0 | |
#define EXPIN_LED 4 | |
Adafruit_MCP23008 expander; | |
void setup() { | |
expander.begin(PIN_EXPANDER_ADDRESS); | |
expander.pinMode(EXPIN_LED, OUTPUT); | |
} | |
void loop() { | |
expander.digitalWrite(EXPIN_LED, LOW); | |
delay(500); | |
expander.digitalWrite(EXPIN_LED, HIGH); | |
delay(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment