using Blynk and Thingspeak in same sketch - multiple server issue?

i have a house ventilation sketch that uses 3 DHT22 sensors placed in 3 air inlets to work out which vent to open to duct to my rooms.

i want to log the readings to Thingspeak and also see them on my smartphone using Blynk.

i slowly combined the sketches and have the ventilation controller, the Blynk app code and Thingspeak code all working but only like this:

  1. ventilation controller + Blnk code
  2. ventilation controller + Thingspeak code

but not like:

  1. ventilation controller code + Blynk code + Thingspeak code

when i try to combine, the Blynk app stops working, but the Thingspeak still works.

is it something to do with the WiFi client code?

how can i fix this?

here is the code: <<too large? over 9000?>>

(if i comment out the void ThingspeakCode() section, the Blynk code works)

any other comments on code welcome - i am totally new at this!!!

attached is a Blynk screenshot

attached is the code, in .txt

how can i add code inline if it is over 9000 char?

sorry.

Forgot to add, this is on an esp8266-12 using 1.6.4 ide

Hi,

Thanks for posting.

First of all, you are initializing WiFi 2 times, which is not good for sure.
Second, could you explain how do you use thingspeak? There is a Widget in Blynk app called History Graph, which can plot up to 4 data streams.

blynk:
Hi,

Thanks for posting.

thanks for replying!

First of all, you are initializing WiFi 2 times, which is not good for sure.

ok, i thought it is an issue,

how do i connect with two servers in one sketch?

can i use a different name, like clientBlynk and clientThingspeak?

how can i implement this?

it seems the blynk library has the client references, so do i need to change the Blynk library?

Second, could you explain how do you use thingspeak? There is a Widget in Blynk app called History Graph, which can plot up to 4 data streams.

i use Thingspeak for data-logging (i.e. download all the collected & stored data to .csv file for analysis), and Blynk for visualisation (i.e. a “dashboard”), and eventually alerts and controls.

also - Thingspeak is available on any internet enabled device, so i can check it anywhere.

Thingspeak and Blynk are intended for very different purposes, so i would like both to function together…

i have found this by SurferTim:

but since the begin.Blynk library seems to have the server stuff in it i am not sure where to start re-coding it.

or is the SurferTim post not relevant?

so it is actually a multiple client issue? not multiple server?

I think I'm making a bit of progress...

Hi Wareemba - were you able to get this working? I have the same question and would like the same setup for the same reasons - that the data on ThingSpeak can be accessed on any device through a browser while I can quickly build and see visualization via Blynk on my phone. If you got it working, please share! :slight_smile: