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:05c503638488, committed 2015-11-05
- Comitter:
- Voldread
- Date:
- Thu Nov 05 16:14:53 2015 +0000
- Parent:
- 1:05b1d2a203e5
- Commit message:
- s
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:14:53 2015 +0000 @@ -2,19 +2,44 @@ Serial serial3(PB_9, PB_8); // tx, rx Serial pc(USBTX, USBRX); // tx, rx +InterruptIn knapp(PC_13); +DigitalOut userLed(PA_5); void serial3Rx() -{ pc.putc(serial3.getc()); +{ + char rxData=serial3.getc(); + if (rxData=='L') { + userLed=1; + } + + if (rxData=='O') { + userLed=0; + } + + pc.putc(rxData); } void pcRx() -{ serial3.putc(pc.getc()); +{ + serial3.putc(pc.getc()); +} + +void KnappTrykket() +{ + serial3.putc('L'); +} + +void KnappTrykketO() +{ + serial3.putc('O'); } int main() { serial3.attach(&serial3Rx); pc.attach(&pcRx); + knapp.fall(&KnappTrykket); + knapp.rise(&KnappTrykketO); while(1) { wait(1);