4180 LabTeam - Spring '18
/
Lab1_Part72
Lab1_Part7
Fork of MCP23S17_Basic_IO_Demo by
Diff: main.cpp
- Revision:
- 7:2e7fe8cc61fc
- Parent:
- 6:9f1bf46845ab
- Child:
- 8:ccf136896865
--- a/main.cpp Wed Jan 31 06:22:29 2018 +0000 +++ b/main.cpp Wed Jan 31 06:29:08 2018 +0000 @@ -50,20 +50,12 @@ // Start Loopback test sending out and reading back values // loopback test uses A0 and B0 pins - so use a wire to jumper those two pins on MCP23S17 together while (1) { - B0 = !(chip.read(PORT_B)& 0x01); + B0 = chip.read(PORT_B)& 0x01; + if(B0 == 0){ + chip.write(PORT_A,1); + } else if (B0 == 1) { + chip.write(PORT_A,0); + } - chip.write(PORT_A,B0); - // chip.write(PORT_A,0); // turn off LED - // write 0xAA to MCP23S17 Port A - // chip.write(PORT_A, 0xAA); - //wait(.5); - // read back value from MCP23S17 Port B and display B0 on mbed led1 - //led1 = chip.read(PORT_B)& 0x01; - // write 0x55 to MCP23S17 Port A - //chip.write(PORT_A, 0x55); - //wait(.5); - // read back value from MCP23S17 Port B and display B0 on mbed led1 - //led1 = chip.read(PORT_B)& 0x01; - // led1 should blink slowly when it is all working } }