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: EthernetInterface mbed-rtos mbed
Dependents: AxedaGo-mbed_WIZnetInterface
Revision 4:22d6467147a5, committed 2014-06-24
- Comitter:
- AxedaCorp
- Date:
- Tue Jun 24 15:40:21 2014 +0000
- Parent:
- 3:359e019da3b9
- Child:
- 5:1b8ad120cf29
- Commit message:
- Added Pot2
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Jun 23 20:08:09 2014 +0000
+++ b/main.cpp Tue Jun 24 15:40:21 2014 +0000
@@ -4,6 +4,7 @@
EthernetInterface eth;
AnalogIn pot1(p19);
+AnalogIn pot2(p20);
TCPSocketConnection sock;
DigitalOut led1(LED1);
@@ -15,7 +16,7 @@
{
char *MODEL = "mbed";
- char *SERIAL_NUM = "nlr__jrogers_axeda_com___6239433";
+ char *SERIAL_NUM = "SerialNumber";
float DEADBAND = 0.015;
char* ip;
@@ -55,13 +56,16 @@
printf(" - IP address:%s\r\n", ip);
float oil_level = 0.0;
+ float oil_level2= 0.0;
float oldPotVal = -2.0;
+ float oldPotVal2 = -2.0;
while(1) {
oil_level = pot1.read();
+ oil_level2=pot2.read();
- if ( abs(oil_level - oldPotVal) < DEADBAND)
+ if ( abs(oil_level - oldPotVal) < DEADBAND && abs(oil_level2 - oldPotVal2) < DEADBAND)
{
continue;
}
@@ -69,10 +73,12 @@
{
led4 = 1;
oldPotVal = oil_level;
- printf("Sending Value %.2f\n\r", oil_level);
+ oldPotVal2 = oil_level2;
+ printf("Sending Value for well1 %.2f\n\r", oil_level);
+ printf("Sending Value for well2 %.2f\n\r", oil_level2);
sock.connect("toolbox-stage-connect.axeda.com", 80);
- snprintf(http_cmd, http_cmd_sz, "POST /ammp/data/1/%s!%s HTTP/1.1\r\nContent-Type: application/json\r\nContent-Length: 47\r\n\r\n{\"data\":[{\"di\":{\"oil_level\":%.2f}}]}\r\n\r\n", MODEL, SERIAL_NUM, oil_level);
+ snprintf(http_cmd, http_cmd_sz, "POST /ammp/data/1/%s!%s HTTP/1.1\r\nContent-Type: application/json\r\nContent-Length: 65\r\n\r\n{\"data\":[{\"di\":{\"oil_level\":%.2f, \"oil_level2\":%.2f}}]}\r\n\r\n", MODEL, SERIAL_NUM, oil_level, oil_level2);
sock.send_all(http_cmd, strlen(http_cmd)-1);
while ( (returnCode = sock.receive(buffer, sizeof(buffer)-1)) > 0)
Axeda GO Kit for ARM mbed