LAB10_Oppgave2

Dependencies:   mbed

Fork of LAB10_Oppgave2 by EL-POM1001

Committer:
rlanghbv
Date:
Wed Nov 04 19:23:37 2015 +0000
Revision:
2:dc9d556924d9
Parent:
1:c3e8496642b4
fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rlanghbv 0:1fe30bae9dc1 1 #include "mbed.h"
rlanghbv 1:c3e8496642b4 2
rlanghbv 0:1fe30bae9dc1 3 Serial pc(USBTX, USBRX);
rlanghbv 1:c3e8496642b4 4
rlanghbv 1:c3e8496642b4 5 // The pc has sendt a char to us
rlanghbv 1:c3e8496642b4 6 void pcTxSrialData()
rlanghbv 1:c3e8496642b4 7 { char rxData=pc.getc();
rlanghbv 1:c3e8496642b4 8 pc.putc(rxData);
rlanghbv 1:c3e8496642b4 9 }
rlanghbv 1:c3e8496642b4 10
rlanghbv 1:c3e8496642b4 11 int main()
rlanghbv 1:c3e8496642b4 12 {
rlanghbv 1:c3e8496642b4 13 //Listen for serial data from the PC
rlanghbv 2:dc9d556924d9 14 pc.attach(&pcTxSrialData);
rlanghbv 1:c3e8496642b4 15
rlanghbv 0:1fe30bae9dc1 16 while (1) {
rlanghbv 1:c3e8496642b4 17 wait(1);
rlanghbv 0:1fe30bae9dc1 18 }
rlanghbv 0:1fe30bae9dc1 19 }
rlanghbv 0:1fe30bae9dc1 20
rlanghbv 0:1fe30bae9dc1 21
rlanghbv 0:1fe30bae9dc1 22