example serial interface for python and LPC11U24

Dependencies:   mbed-rpc mbed

Fork of RPC_Serial by Michael Walker

Committer:
bhavik
Date:
Thu Jun 19 16:32:21 2014 +0000
Revision:
2:fadccef926e4
Parent:
1:de34af25056a
example serial interface for python and LPC11U24

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MichaelW 0:78952cd3935b 1 #include "mbed.h"
MichaelW 0:78952cd3935b 2 #include "rpc.h"
bhavik 2:fadccef926e4 3
MichaelW 0:78952cd3935b 4 Serial pc(USBTX, USBRX);
bhavik 2:fadccef926e4 5
MichaelW 0:78952cd3935b 6 int main() {
MichaelW 1:de34af25056a 7 // setup the classes that can be created dynamically
MichaelW 0:78952cd3935b 8 Base::add_rpc_class<AnalogIn>();
MichaelW 0:78952cd3935b 9 Base::add_rpc_class<AnalogOut>();
MichaelW 0:78952cd3935b 10 Base::add_rpc_class<DigitalIn>();
MichaelW 0:78952cd3935b 11 Base::add_rpc_class<DigitalOut>();
MichaelW 0:78952cd3935b 12 Base::add_rpc_class<DigitalInOut>();
MichaelW 0:78952cd3935b 13 Base::add_rpc_class<PwmOut>();
MichaelW 0:78952cd3935b 14 Base::add_rpc_class<Timer>();
MichaelW 0:78952cd3935b 15 Base::add_rpc_class<SPI>();
MichaelW 0:78952cd3935b 16 Base::add_rpc_class<BusOut>();
MichaelW 0:78952cd3935b 17 Base::add_rpc_class<BusIn>();
MichaelW 0:78952cd3935b 18 Base::add_rpc_class<BusInOut>();
MichaelW 0:78952cd3935b 19 Base::add_rpc_class<Serial>();
MichaelW 1:de34af25056a 20 // receive commands, and send back the responses
MichaelW 0:78952cd3935b 21 char buf[256], outbuf[256];
MichaelW 0:78952cd3935b 22 while(1) {
MichaelW 0:78952cd3935b 23 pc.gets(buf, 256);
MichaelW 0:78952cd3935b 24 rpc(buf, outbuf);
MichaelW 0:78952cd3935b 25 pc.printf("%s\n", outbuf);
MichaelW 0:78952cd3935b 26 }
MichaelW 0:78952cd3935b 27 }