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.
Dependencies: mbed
Fork of mbed_serial_test by
main.cpp@0:47c7262c17ac, 2015-09-01 (annotated)
- Committer:
- AlpNov
- Date:
- Tue Sep 01 02:06:26 2015 +0000
- Revision:
- 0:47c7262c17ac
- Child:
- 1:5c5cd69a3cf8
First commit, can receive messages but cannot send
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| AlpNov | 0:47c7262c17ac | 1 | #include "mbed.h" |
| AlpNov | 0:47c7262c17ac | 2 | |
| AlpNov | 0:47c7262c17ac | 3 | Serial pc(USBTX, USBRX); |
| AlpNov | 0:47c7262c17ac | 4 | Serial BLEmate(p9,p10); //tx,rx |
| AlpNov | 0:47c7262c17ac | 5 | |
| AlpNov | 0:47c7262c17ac | 6 | DigitalOut led1(LED1); |
| AlpNov | 0:47c7262c17ac | 7 | |
| AlpNov | 0:47c7262c17ac | 8 | |
| AlpNov | 0:47c7262c17ac | 9 | void BLEmateready(); |
| AlpNov | 0:47c7262c17ac | 10 | |
| AlpNov | 0:47c7262c17ac | 11 | int main() { |
| AlpNov | 0:47c7262c17ac | 12 | BLEmate.attach(&BLEmateready); |
| AlpNov | 0:47c7262c17ac | 13 | pc.printf("Something from mbed to PC\n\r"); |
| AlpNov | 0:47c7262c17ac | 14 | while (1) { |
| AlpNov | 0:47c7262c17ac | 15 | led1 = !led1; |
| AlpNov | 0:47c7262c17ac | 16 | wait(0.5); |
| AlpNov | 0:47c7262c17ac | 17 | } |
| AlpNov | 0:47c7262c17ac | 18 | } |
| AlpNov | 0:47c7262c17ac | 19 | |
| AlpNov | 0:47c7262c17ac | 20 | void BLEmateready() { |
| AlpNov | 0:47c7262c17ac | 21 | pc.printf("phone sends: "); |
| AlpNov | 0:47c7262c17ac | 22 | while ( BLEmate.readable() ) { |
| AlpNov | 0:47c7262c17ac | 23 | pc.putc(BLEmate.getc()); |
| AlpNov | 0:47c7262c17ac | 24 | } |
| AlpNov | 0:47c7262c17ac | 25 | pc.printf("\n\r"); |
| AlpNov | 0:47c7262c17ac | 26 | } |
