Lab1_Part7

Dependencies:   MCP23S17 mbed

Fork of MCP23S17_Basic_IO_Demo by jim hamblen

Files at this revision

API Documentation at this revision

Comitter:
bjs9
Date:
Wed Jan 31 06:19:25 2018 +0000
Parent:
4:58a089a8b601
Child:
6:9f1bf46845ab
Commit message:
Change

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Jan 31 06:14:18 2018 +0000
+++ b/main.cpp	Wed Jan 31 06:19:25 2018 +0000
@@ -30,7 +30,7 @@
 // Optional software reset - mbed p14 to MCP23S17 reset pin
 // DigitalOut reset(p14);
 
-DigitalOut led1(LED1); // mbed LED1 is used for test status display
+ // mbed LED1 is used for test status display
 int B0;
 int main() {
 //  The MCP23S17 reset pin can just be pulled high, since it has a power on reset circuit.
@@ -47,17 +47,12 @@
     chip.direction(PORT_A, 0x00);
 //  Set all 8 Port B bits to input direction
     chip.direction(PORT_B, 0xFF);
-    led1=0;
 //  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) {
-        led1= chip.read(PORT_B)& 0x01;
-       // if (B0 == 0)
-        //{
-        //    chip.write(PORT_A,1); // output 1 at A0 to light up LED 
-        //} else {
+        B0 = chip.read(PORT_B)& 0x01;
+        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);