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.
Dependents: ClassFRDM ClassLPC
main.cpp@1:9cfb17f74dcd, 2015-03-19 (annotated)
- Committer:
- askksa12543
- Date:
- Thu Mar 19 11:54:05 2015 +0000
- Revision:
- 1:9cfb17f74dcd
- Parent:
- 0:60c4436f7667
finished initial design
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| askksa12543 | 0:60c4436f7667 | 1 | #include "mbed.h" |
| askksa12543 | 0:60c4436f7667 | 2 | #include "DataComm.h" |
| askksa12543 | 0:60c4436f7667 | 3 | |
| askksa12543 | 1:9cfb17f74dcd | 4 | DataComm test; //create data communication protocol variable |
| askksa12543 | 1:9cfb17f74dcd | 5 | char data[4] = "Hi!"; //test data |
| askksa12543 | 1:9cfb17f74dcd | 6 | int size = 3; |
| askksa12543 | 1:9cfb17f74dcd | 7 | DigitalOut myled(LED1); // red led on board |
| askksa12543 | 0:60c4436f7667 | 8 | |
| askksa12543 | 0:60c4436f7667 | 9 | int main() |
| askksa12543 | 0:60c4436f7667 | 10 | { |
| askksa12543 | 1:9cfb17f74dcd | 11 | myled = 1; //turn off led |
| askksa12543 | 1:9cfb17f74dcd | 12 | test.setClockOut(D8); //clock out pin |
| askksa12543 | 1:9cfb17f74dcd | 13 | test.setSerialOut(D7); //data out pin |
| askksa12543 | 1:9cfb17f74dcd | 14 | test.setClock(2000); //set 2 second clock |
| askksa12543 | 1:9cfb17f74dcd | 15 | test.initiate_connection(); //send preamble |
| askksa12543 | 1:9cfb17f74dcd | 16 | test.send_data(data, size); //send data |
| askksa12543 | 1:9cfb17f74dcd | 17 | test.close_connection(); //send postamble |
| askksa12543 | 1:9cfb17f74dcd | 18 | myled = 0; //turn on led to indicate completion of code |
| askksa12543 | 0:60c4436f7667 | 19 | } |