Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
You are viewing an older revision! See the latest version
Homepage
include the mbed library with this snippet
#include "mbed.h" #include "MCP23016.h" MCP23016 PortExpand(D4, D5, 0); DigitalOut myled(LED1); int main() { PortExpand.pinMode(0, DIR_OUTPUT); PortExpand.pinMode(8, DIR_OUTPUT); while(1) { PortExpand.digitalWrite(0, 1); PortExpand.digitalWrite(8, 0); myled = 1; // LED is ON wait(1); // 200 ms PortExpand.digitalWrite(0, 0); PortExpand.digitalWrite(8, 1); myled = 0; // LED is OFF wait(1); // 1 sec } }