s

Dependencies:   mbed

Fork of LAB10_Oppgave3 by EL-POM1001

Committer:
rlanghbv
Date:
Wed Nov 04 21:02:48 2015 +0000
Revision:
1:05b1d2a203e5
Parent:
0:00b5baa80198
Serial 3 to PC loopback

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rlanghbv 0:00b5baa80198 1 #include "mbed.h"
rlanghbv 0:00b5baa80198 2
rlanghbv 0:00b5baa80198 3 Serial serial3(PB_9, PB_8); // tx, rx
rlanghbv 0:00b5baa80198 4 Serial pc(USBTX, USBRX); // tx, rx
rlanghbv 0:00b5baa80198 5
rlanghbv 0:00b5baa80198 6 void serial3Rx()
rlanghbv 1:05b1d2a203e5 7 { pc.putc(serial3.getc());
rlanghbv 0:00b5baa80198 8 }
rlanghbv 0:00b5baa80198 9
rlanghbv 0:00b5baa80198 10 void pcRx()
rlanghbv 1:05b1d2a203e5 11 { serial3.putc(pc.getc());
rlanghbv 0:00b5baa80198 12 }
rlanghbv 0:00b5baa80198 13
rlanghbv 1:05b1d2a203e5 14 int main()
rlanghbv 1:05b1d2a203e5 15 {
rlanghbv 0:00b5baa80198 16 serial3.attach(&serial3Rx);
rlanghbv 0:00b5baa80198 17 pc.attach(&pcRx);
rlanghbv 1:05b1d2a203e5 18
rlanghbv 1:05b1d2a203e5 19 while(1) {
rlanghbv 1:05b1d2a203e5 20 wait(1);
rlanghbv 1:05b1d2a203e5 21 }
rlanghbv 0:00b5baa80198 22 }
rlanghbv 0:00b5baa80198 23
rlanghbv 0:00b5baa80198 24
rlanghbv 0:00b5baa80198 25
rlanghbv 0:00b5baa80198 26