Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: WiflyInterface mbed nsdl_lib MLX90614 C12832_lcd mbed-rtos Beep
Diff: i2c_temp_test_main.cpp
- Revision:
- 13:0f7e477c75af
- Parent:
- 12:6c6ca43cccec
diff -r 6c6ca43cccec -r 0f7e477c75af i2c_temp_test_main.cpp
--- a/i2c_temp_test_main.cpp Mon Apr 13 06:55:46 2015 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-#include "mbed.h"
-#include "WiflyInterface.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
-*/
-
-/*char * SSID = "mbed";
-char * WIFI_PASS = "password";
-
-WiflyInterface wifly(p9, p10, p30, p29, SSID, WIFI_PASS, WPA);
-DigitalOut waitLed(LED1); //displays I2C wait
-I2C i2c(p28,p27); //sda,scl
-//Serial pc(USBTX, USBRX);
-MLX90614 IR_thermometer(&i2c);
-AnalogIn weight(p15);
-
-
-float temp;
-int main()
-{
- char json_str[100];
-
- wifly.init(); //Use DHCP
- while (!wifly.connect());
- printf("IP Address is %s\n\r", wifly.getIPAddress());
-
- // See the output on http://sockets.mbed.org/app-board/viewer
- Websocket ws("ws://sockets.mbed.org:443/ws/app-board/wo");
-
- // connect WS server
- while (!ws.connect());
-
- while (1) {
-
- waitLed=1; // if led1 on - waiting on I2C
- if (IR_thermometer.getTemp(&temp)) {
- //gets temperature from sensor via I2C bus
- waitLed=0;
- //print temperature on PC
- }
- //wait for device to produce next temperature reading
- wait(0.5);
- // create json string with tmp data
- float sum = 0;
- for(int i = 0; i < 40; i++){
- sum = sum + 100*weight.read();
- wait(0.01);
- }
- float resistors = sum / 40;
- sprintf(json_str, "{\"id\":\"app_board_wifly_EW2013\",\"tmp\":%f,\"resistors\":%f}", temp, resistors);
-
-
- // send str
- ws.send(json_str);
- wait(0.1);
- /*sprintf(json_str, "{\"id\":\"app_board_wifly_EW2013\",\"resistors\":%f}", (weight.read()));
-
-
- // send str
- ws.send(json_str);
- }
-}*/
\ No newline at end of file