ESP8266 component how do you send info

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times

ESP8266 component how do you send info

Post by acestu »

-Hi,

I am trying to setup an esp8266 wifi module to send data to a Thingspeak account, now I have the information that you have to send which is:

Update your Channel via URL:

*https://api.thingspeak.com/update?api_k ... Y&field1=7

I don't know how to send this information because the example I have uses the "Client Send Request" macro which is requesting information, would I use the send string macro instead with the above information in it ?

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: ESP8266 component how do you send info

Post by kersing »

If I'm not mistaken the client send request example contains an URL to send the request to. Replace that URL with the one you mention in your message and use the result to check if the call succeeded.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times

Re: ESP8266 component how do you send info

Post by acestu »

Hi Jac,

I was not sure weather I could use a domain instead of ip address , and the example uses the "Clientsendrequest" macro after it has connected, I am not requesting anything I want to send info so should I be using the "sendstring" macro ?

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times

Re: ESP8266 component how do you send info

Post by acestu »

Hi,

I have tried to convert "https://api.thingspeak.com" to an ip address on the internet but it comes back as "cannot be resolved to an IP Address" so I don't know what to put in the ip box ?

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: ESP8266 component how do you send info

Post by kersing »

Stuart,

You need to take the URL apart into components:
https:// or http:// - signal the protocol to use for the transfer, the (secure) HyperText Transfer Protocol
api.thingspeak.com - the host to connect to, in this case the IP is 144.212.80.11
/update - the 'resource' you want to access
?api_key=... - arguments provided.

Can you point me to the example you are using? (Or attach it)
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times

Re: ESP8266 component how do you send info

Post by acestu »

Hi Jac,


Thanks for the ip info, the only example I have for flowcode is the esp8266_TCPClient, so I am trying to break down arduino examples off the thingspeak website,

the update string that is sent includes the api code for your particular channel so eventually it will be in degrees celsius calculated from a temp sensor but for test purposes it can be anything.

Thanks
Stuart

https://thingspeak.com/docs



The flashing led is in the code because I am having problems setting config bits on the pic18f24j11 so I reverted to old faithful pic16f877a
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times

Re: ESP8266 component how do you send info

Post by kersing »

Try the attached flowchart (you need to insert you API key and WIFI settings).

When connecting to a webserver, once the TCP connection is established you need to tell it what you want. The simplest command is 'GET ' followed by the resource and parameters.
Attachments
ESP8266_Thingspeak.fcfx
(10.41 KiB) Downloaded 461 times
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times

Re: ESP8266 component how do you send info

Post by acestu »

Hi Jac,

Yes it is the "Get" statement that was confusing me because it infers that it wants to retrieve something and not send something, I will set it up and try it....

Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times

Re: ESP8266 component how do you send info

Post by acestu »

Hi,

Wow that little chart was too big in memory for a pic16f877a, I will have to try and get the pic18f24j11 working.....
memfailure.png
(8.05 KiB) Downloaded 6321 times
Thanks
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

MJU
Posts: 502
Joined: Wed Nov 07, 2007 6:51 pm
Location: Antwerp Belgium
Has thanked: 121 times
Been thanked: 108 times

Re: ESP8266 component how do you send info

Post by MJU »

Anyone knows how to send this request via the ESP8266 macro in Flowcode?

https://query.yahooapis.com/v1/public/y ... stics=true

I found in previous example to first connect to Yahoo via "Client connect", and after that issue a "Send String".
But how do I break up the example URL I need to connect to?

Everything I've tried sends back connection error or IP error. :-(

Post Reply