3-Axio Digital Gyro
Dependencies: ITG3200 WebSocketClient WiflyInterface mbed
Revision 0:f9e7b38b17ff, committed 2015-02-06
- Comitter:
- mbedschool
- Date:
- Fri Feb 06 04:55:02 2015 +0000
- Commit message:
- gyro
Changed in this revision
diff -r 000000000000 -r f9e7b38b17ff ITG3200.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ITG3200.lib Fri Feb 06 04:55:02 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/teams/components/code/ITG3200/#ff0a59c5c2f7
diff -r 000000000000 -r f9e7b38b17ff WebSocketClient.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WebSocketClient.lib Fri Feb 06 04:55:02 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/samux/code/WebSocketClient/#466f90b7849a
diff -r 000000000000 -r f9e7b38b17ff WiflyInterface.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WiflyInterface.lib Fri Feb 06 04:55:02 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/WiflyInterface/#fb4494783863
diff -r 000000000000 -r f9e7b38b17ff main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Feb 06 04:55:02 2015 +0000 @@ -0,0 +1,52 @@ +#include "mbed.h" +#include "WiflyInterface.h" +#include "Websocket.h" +#include "ITG3200.h" + + +/* wifly interface: +* - p9 and p10 are for the serial communication +* - p19 is for the reset pin +* - p26 is for the connection status +* - "mbed" is the ssid of the network +* - "password" is the password +* - WPA is the security +*/ +WiflyInterface wifly(p13, p14, p19, p26, "WWNet", "mmmmmmmm", WPA); +DigitalOut led1(LED1); +ITG3200 gyro(p9, p10, 0x68); + + + +int main() { + wifly.init(); //Use DHCP + //wifly.init("192.168.21.33","255.255.255.0","192.168.21.2"); + while (!wifly.connect()); + led1=1; + printf("IP Address is %s\n\r", wifly.getIPAddress()); + + Websocket ws("ws://sockets.mbed.org/ws/mbedschool/viewer"); + //Websocket ws("ws://192.168.199.159:8888"); + while (!ws.connect()); + led1=2; + + + int x = 0, y = 0, z = 0, temp = 0; + //Set highest bandwidth. + gyro.setLpBandwidth(LPFBW_42HZ); + + while (1) { + char data[256]; + wait(0.1f); + x = gyro.getGyroX(); + y = gyro.getGyroY(); + z = gyro.getGyroZ(); + temp = gyro.getTemperature(); + + printf("Temp: %d, X: %d, Y: %d, Z: %d\n", temp, x, y, z); + sprintf( data , "Temp: %d, X: %d, Y: %d, Z: %d\n", temp, x, y, z ); + ws.send(data); + + //wait(1.0); + } +}
diff -r 000000000000 -r f9e7b38b17ff mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Feb 06 04:55:02 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file