shubham c
/
relay_test
relay_working_code
Revision 0:342d1037264a, committed 2015-01-31
- Comitter:
- ee12b079
- Date:
- Sat Jan 31 11:53:56 2015 +0000
- Commit message:
- relay_working_code
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 342d1037264a main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Jan 31 11:53:56 2015 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" +void writereg(uint8_t ,uint8_t ); +uint8_t readreg(uint8_t); +//Serial pc(USBTX, USBRX); // tx, rx +Serial pc(USBTX, USBRX); +//SPI spi(D11, D12, D13); // mosi, miso, sclk +DigitalOut cs1(D12); //slave select or chip select +DigitalOut cs2(D13); //slave select or chip select + +main() +{ + char ch; + while(1){ + ch = pc.getc(); + //putchar(ch); + if(ch == 'A') + { + //cs2 = 0; + putchar(ch); + cs1 = 1; + wait_ms(1); + cs1 = 0; + } + if(ch == 'B') + { + //cs1 = 0; + putchar(ch); + cs2 = 1; + wait_ms(1); + cs2 = 0; + }} + } \ No newline at end of file
diff -r 000000000000 -r 342d1037264a mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jan 31 11:53:56 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file