Lab that has to do with basic IO on mbed.
Dependencies: DebounceIn mbed PinDetect
GeorgesLab1/AssemblyMain.cpp@53:1c8235c49b70, 2016-01-24 (annotated)
- Committer:
- Jesse Baker
- Date:
- Sun Jan 24 16:45:15 2016 -0500
- Revision:
- 53:1c8235c49b70
- Parent:
- 49:f2081d0f5eec
JB is about to test expansion
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gtzintzarov3 | 49:f2081d0f5eec | 1 | /* CODE NO LONGER IN USE |
gtzintzarov3 | 47:0efd125c7f2d | 2 | #include "mbed.h" |
gtzintzarov3 | 47:0efd125c7f2d | 3 | #include "PinDetect.h" |
gtzintzarov3 | 47:0efd125c7f2d | 4 | // This program will blink LED1 and LED4 |
gtzintzarov3 | 47:0efd125c7f2d | 5 | // using assembly language for LED1 and |
gtzintzarov3 | 47:0efd125c7f2d | 6 | // API functions for LED4 |
gtzintzarov3 | 47:0efd125c7f2d | 7 | // declare external assembly language function (in a *.s file) |
gtzintzarov3 | 47:0efd125c7f2d | 8 | extern "C" int my_asm(int value); |
gtzintzarov3 | 47:0efd125c7f2d | 9 | // declare LED outputs – let C set them up as output bits |
gtzintzarov3 | 47:0efd125c7f2d | 10 | DigitalOut myled1(p30); |
gtzintzarov3 | 47:0efd125c7f2d | 11 | //DigitalOut myled4(LED4); |
gtzintzarov3 | 47:0efd125c7f2d | 12 | PinDetect pb(p28); |
gtzintzarov3 | 47:0efd125c7f2d | 13 | |
gtzintzarov3 | 47:0efd125c7f2d | 14 | int main() { |
gtzintzarov3 | 47:0efd125c7f2d | 15 | pb.mode(PullUp); |
gtzintzarov3 | 47:0efd125c7f2d | 16 | |
gtzintzarov3 | 47:0efd125c7f2d | 17 | //int value = pb; |
gtzintzarov3 | 47:0efd125c7f2d | 18 | // loop forever |
gtzintzarov3 | 47:0efd125c7f2d | 19 | while(1) { |
gtzintzarov3 | 47:0efd125c7f2d | 20 | //call assembly language function to control LED1 |
gtzintzarov3 | 47:0efd125c7f2d | 21 | my_asm(!pb); |
gtzintzarov3 | 47:0efd125c7f2d | 22 | //API function to control LED4 |
gtzintzarov3 | 47:0efd125c7f2d | 23 | //myled4 = value; |
gtzintzarov3 | 47:0efd125c7f2d | 24 | // flip value and wait |
gtzintzarov3 | 47:0efd125c7f2d | 25 | //value = ~ pb; |
gtzintzarov3 | 47:0efd125c7f2d | 26 | //wait(0.2); |
gtzintzarov3 | 47:0efd125c7f2d | 27 | } |
gtzintzarov3 | 49:f2081d0f5eec | 28 | } |
gtzintzarov3 | 49:f2081d0f5eec | 29 | |
gtzintzarov3 | 49:f2081d0f5eec | 30 | */ |