websocket client for gyro and 3-Axio Accelerometer
Dependencies: ITG3200 MMA7660FC WebSocketClient WiflyInterface mbed
Revision 3:b625c8d95e74, committed 2015-02-05
- Comitter:
- mbedschool
- Date:
- Thu Feb 05 06:31:28 2015 +0000
- Parent:
- 2:edb0c7e84275
- Commit message:
- update
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Feb 05 04:29:21 2015 +0000 +++ b/main.cpp Thu Feb 05 06:31:28 2015 +0000 @@ -27,7 +27,7 @@ wifly.init(); //Use DHCP while (!wifly.connect()); led1=1; - Websocket ws("ws://sockets.mbed.org/ws/mbedschool/viewer"); + Websocket ws("ws://192.168.21.104:8080"); while (!ws.connect()); led1=2; @@ -54,7 +54,7 @@ float ax=0, ay=0, az=0; Acc.read_Tilt(&x, &y, &z); // Read the acceleration - wait_ms(100); + ax = G_VALUE[Acc.read_x()]; ay = G_VALUE[Acc.read_y()]; az = G_VALUE[Acc.read_z()]; @@ -64,8 +64,7 @@ //websocket send data sprintf( data , "{ \"x\": %d, \"y\": %d, \"z\": %d , \"ax\": %f, \"ay\": %f, \"az\": %f\n}", gyro_x, gyro_y, gyro_z ,ax,ay,az); ws.send(data); - - wait(1.0); + } }