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 LAB10_Oppgave3 by
Revision 2:497a47bd157b, committed 2015-11-05
- Comitter:
- madmonkeyman82
- Date:
- Thu Nov 05 16:21:25 2015 +0000
- Parent:
- 1:05b1d2a203e5
- Commit message:
- first
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Nov 04 21:02:48 2015 +0000 +++ b/main.cpp Thu Nov 05 16:21:25 2015 +0000 @@ -2,19 +2,43 @@ Serial serial3(PB_9, PB_8); // tx, rx Serial pc(USBTX, USBRX); // tx, rx +InterruptIn button(PC_13); +DigitalOut led(PA_5); void serial3Rx() -{ pc.putc(serial3.getc()); +{ + char rx_temp = serial3.getc(); + pc.putc(rx_temp); + if(rx_temp == 'L') + { + led=1; + } + else + { + led=0; + } } void pcRx() { serial3.putc(pc.getc()); } +void buttonpress() +{ + serial3.putc('M'); +} + +void buttonrelease() +{ + serial3.putc('L'); +} int main() { serial3.attach(&serial3Rx); pc.attach(&pcRx); + button.rise(&buttonpress); + button.fall(&buttonrelease); + button.enable_irq(); while(1) { wait(1);