example serial interface for python and LPC11U24 - analogin and pwm working

Dependencies:   mbed-rpc mbed

Fork of RPC_Serial_new by bhavik gala

Committer:
bhavik
Date:
Thu Jun 26 14:49:25 2014 +0000
Revision:
5:1caee8f66e14
Parent:
4:726b4e996614
Child:
6:f83b71016626
analog testing

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MichaelW 0:78952cd3935b 1 #include "mbed.h"
bhavik 3:726cfc72fe9a 2 #include "mbed_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
bhavik 5:1caee8f66e14 8 RPC::add_rpc_class<RpcAnalogOut>();
bhavik 4:726b4e996614 9 RPC::add_rpc_class<RpcAnalogOut>();
bhavik 3:726cfc72fe9a 10 RPC::add_rpc_class<RpcDigitalIn>();
bhavik 4:726b4e996614 11 RPC::add_rpc_class<RpcDigitalOut>();
bhavik 5:1caee8f66e14 12
bhavik 5:1caee8f66e14 13 RpcDigitalOut rpc_led(LED1, "led");
bhavik 3:726cfc72fe9a 14
MichaelW 1:de34af25056a 15 // receive commands, and send back the responses
bhavik 3:726cfc72fe9a 16 char buf[256], outbuf[256];
bhavik 3:726cfc72fe9a 17
MichaelW 0:78952cd3935b 18 while(1) {
MichaelW 0:78952cd3935b 19 pc.gets(buf, 256);
bhavik 3:726cfc72fe9a 20 RPC::call(buf, outbuf);
MichaelW 0:78952cd3935b 21 pc.printf("%s\n", outbuf);
MichaelW 0:78952cd3935b 22 }
MichaelW 0:78952cd3935b 23 }