An RPC program that reads data from an Accelerometer(MMA7660) on the Mbed developement board and sends it to the PC trough a serial connection
Dependencies: MMA7660 RPCInterface mbed
Fork of RPC_Serial by
Revision 2:c079ba242f7c, committed 2014-03-10
- Comitter:
- sammekevremde
- Date:
- Mon Mar 10 11:49:35 2014 +0000
- Parent:
- 1:de34af25056a
- Commit message:
- RPC program that reads data from the accelerometer on the development board and sends it to PC trough a serial connection
Changed in this revision
diff -r de34af25056a -r c079ba242f7c MMA7660.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA7660.lib Mon Mar 10 11:49:35 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/MMA7660/#a8e20db7901e
diff -r de34af25056a -r c079ba242f7c RPCInterface.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RPCInterface.lib Mon Mar 10 11:49:35 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/MichaelW/code/RPCInterface/#682c65afe534
diff -r de34af25056a -r c079ba242f7c main.cpp --- a/main.cpp Tue Aug 24 15:15:44 2010 +0000 +++ b/main.cpp Mon Mar 10 11:49:35 2014 +0000 @@ -1,7 +1,27 @@ #include "mbed.h" #include "rpc.h" +#include "RPCVariable.h" +//#include "LM75B.h" +#include "MMA7660.h" + + + Serial pc(USBTX, USBRX); +AnalogIn pot1 (p19, "pot1"); +//LM75B tmp(p28,p27); +MMA7660 MMA(p28, p27); + +//float t1; +float x, tmpx; +float y; +float z; +//RPCVariable<float>RPCtemp(&t1,"t1"); +RPCVariable<float>RPCx(&x,"x-as"); +RPCVariable<float>RPCy(&y,"y-as"); +RPCVariable<float>RPCz(&z,"z-as"); + int main() { + pc.baud(57600); // setup the classes that can be created dynamically Base::add_rpc_class<AnalogIn>(); Base::add_rpc_class<AnalogOut>(); @@ -18,6 +38,12 @@ // receive commands, and send back the responses char buf[256], outbuf[256]; while(1) { + //t1 = tmp.read(); + + x = MMA.x(); + y = MMA.y(); + z = MMA.z(); + pc.gets(buf, 256); rpc(buf, outbuf); pc.printf("%s\n", outbuf);