how can I send float value in url? I tried float values but I ended up getting Null values

0 votes
How can I send the values and insert the values into the database?

float PHValue = Value/10;
  float DOValue= 12.22;
  gprsSerial.println("AT+HTTPPARA=\"URL\",\"http://itempurl.com/smartpond/AddTemprature?WaterTemperature=""+celsius+""&PHValue=""+PHValue+""&DOValue=""+DOValue+""&currentTime=06-30-2016\"");

Thanks!
Aug 28, 2018 in IoT (Internet of Things) by Upasana
• 8,430 points
58 views

1 answer to this question.

0 votes

You can use print() to send  it as in the following:

int n_decimals = 3;
float PHValue = Value/10;
float DOValue= 12.22;

gprsSerial.print("AT+HTTPPARA=\"URL\",\"http://itempurl.com/smartpond/AddTemprature?WaterTemperature=");
gprsSerial.print(celsius, n_decimals);
gprsSerial.print("&PHValue=");
gprsSerial.print(PHValue, n_decimals);
gprsSerial.print("&DOValue=");
gprsSerial.print(DOValue, n_decimals);
gprsSerial.println("&currentTime=06-30-2016\"");
With n_decimals the number of decimal places that you want to be printed.

Or  you can also use snprintf to generate your AT command:

char command[256];
float PHValue = Value/10;
float DOValue= 12.22;

snprintf(command, sizeof(command), "AT+HTTPPARA=\"URL\",\""
          "http://itempurl.com/smartpond/AddTemprature?"
          "WaterTemperature=%f&PHValue=%f&DOValue=%f"
          "&currentTime=06-30-2016\"", celsius, PHValue, DOValue);
gprsSerial.println(command);

answered Aug 28, 2018 by Annie97
• 2,190 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer
0 votes
1 answer

Setting-up a RFID RC522 chip in Raspberry Pi?

First, let me congratulate you on buying ...READ MORE

answered Jul 9, 2018 in IoT (Internet of Things) by nirvana
• 3,060 points
108 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Suggest Implementation method for Smart Parking Points

They are different things. Raspberry PI is ...READ MORE

answered Aug 24, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
18 views
0 votes
1 answer

OMA LWM2M communication with Arduino

You'll have to understand that an Arduino ...READ MORE

answered Aug 27, 2018 in IoT (Internet of Things) by nirvana
• 3,060 points
183 views
0 votes
1 answer

Can i use ESP8266 as a network adapter?

With the Espressif SDK 1.5.2 for the ESP8266 it's not possible ...READ MORE

answered Sep 12, 2018 in IoT (Internet of Things) by Annie97
• 2,190 points
41 views