example serial interface for python and LPC11U24 - analogin and pwm working
Fork of RPC_Serial_new by
Diff: main.cpp
- Revision:
- 3:726cfc72fe9a
- Parent:
- 2:fadccef926e4
- Child:
- 4:726b4e996614
diff -r fadccef926e4 -r 726cfc72fe9a main.cpp --- a/main.cpp Thu Jun 19 16:32:21 2014 +0000 +++ b/main.cpp Fri Jun 20 13:14:44 2014 +0000 @@ -1,27 +1,31 @@ #include "mbed.h" -#include "rpc.h" +#include "mbed_rpc.h" Serial pc(USBTX, USBRX); int main() { // setup the classes that can be created dynamically - Base::add_rpc_class<AnalogIn>(); - Base::add_rpc_class<AnalogOut>(); - Base::add_rpc_class<DigitalIn>(); - Base::add_rpc_class<DigitalOut>(); - Base::add_rpc_class<DigitalInOut>(); - Base::add_rpc_class<PwmOut>(); - Base::add_rpc_class<Timer>(); - Base::add_rpc_class<SPI>(); - Base::add_rpc_class<BusOut>(); - Base::add_rpc_class<BusIn>(); - Base::add_rpc_class<BusInOut>(); - Base::add_rpc_class<Serial>(); + /*RPC::add_rpc_class<AnalogIn>(); + //RPC::add_rpc_class<AnalogOut>(); + RPC::add_rpc_class<DigitalIn>(); + RPC::add_rpc_class<DigitalOut>(); + RPC::add_rpc_class<DigitalInOut>(); + RPC::add_rpc_class<PwmOut>(); + RPC::add_rpc_class<Timer>(); + RPC::add_rpc_class<SPI>(); + RPC::add_rpc_class<BusOut>(); + RPC::add_rpc_class<BusIn>(); + RPC::add_rpc_class<BusInOut>(); + RPC::add_rpc_class<Serial>();*/ + + RPC::add_rpc_class<RpcDigitalIn>(); + // receive commands, and send back the responses - char buf[256], outbuf[256]; + char buf[256], outbuf[256]; + while(1) { pc.gets(buf, 256); - rpc(buf, outbuf); + RPC::call(buf, outbuf); pc.printf("%s\n", outbuf); } }