Обмен данными между двумя ESP8266, хоть как то

Could You just give me link with exammles?
I understand what you’re talking about. That’s what I need. But I can’t do anything practical… I don’t know what to write.
https://github.com there are no examples on the topic of blynk-server.

I’d suggest that you post your code and the actual full compiler error message, not just as partial screenshot.
You also need to clarify whether you’re trying to compile this for an ESP8266 or ESP32.

Pete.

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = BLYNK_AUTH_TOKEN;
void api_bridge(String token, int virtual_pin, float value_to_send) { 
  HTTPClient http; 
  String server_path = server_name + “update?token=” + token + “&pin=v” + String(virtual_pin) + “&value=” + float(value_to_send)
}
void setup() {
Blynk.begin(auth, ssid, pass);
}
void loop() {
  Blynk.run();
...
if(...) { api_bridge(auth, V16, valv); }
...
}

Both ESP8266.

Arduino: 1.8.9 (Windows 7), Плата:“NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200”

Boiler:195:38: error: extended character “ is not valid in an identifier
195 | String server_path = server_name + “update?token=” + token + “&pin=v” + String(virtual_pin) + “&value=” + float(value_to_send)
| ^
Boiler:195:54: error: extended character ” is not valid in an identifier
195 | String server_path = server_name + “update?token=” + token + “&pin=v” + String(virtual_pin) + “&value=” + float(value_to_send)
| ^
Boiler:195:68: error: extended character “ is not valid in an identifier
195 | String server_path = server_name + “update?token=” + token + “&pin=v” + String(virtual_pin) + “&value=” + float(value_to_send)
| ^
Boiler:195:76: error: extended character ” is not valid in an identifier
195 | String server_path = server_name + “update?token=” + token + “&pin=v” + String(virtual_pin) + “&value=” + float(value_to_send)
| ^
Boiler:195:105: error: extended character “ is not valid in an identifier
195 | String server_path = server_name + “update?token=” + token + “&pin=v” + String(virtual_pin) + “&value=” + float(value_to_send)
| ^
Boiler:195:115: error: extended character ” is not valid in an identifier
195 | String server_path = server_name + “update?token=” + token + “&pin=v” + String(virtual_pin) + “&value=” + float(value_to_send)
| ^
exit status 1
extended character “ is not valid in an identifier

Этот отчёт будет иметь больше информации с
включенной опцией Файл → Настройки →
“Показать подробный вывод во время компиляции”

Okay, that appears to be caused by using the wrong quotation mark symbols.

This … "

is the correct symbol. The compiler doesn’t recognise “ or ” as being valid quotation mark symbols.

Pete.

Yes you are right. I don’t know how I didn’t notice it.
Which library do I need to include?
Boiler:194:3: error: ‘HTTPClient’ was not declared in this scope
194 | HTTPClient http;
| ^~~~~~~~~~
Boiler:195:24: error: ‘server_name’ was not declared in this scope; did you mean ‘server_path’?
195 | String server_path = server_name + “update?token=” + token + “&pin=v” + String(virtual_pin) + “&value=” + float(value_to_send);
| ^~~~~~~~~~~
| server_path
exit status 1
‘HTTPClient’ was not declared in this scope

It’s all in the link I provided…

Pete.

what link are You always talking about?

Boiler:195:24: error: ‘server_name’ was not declared in this scope; did you mean ‘server_path’?
195 | String server_path = server_name + “update?token=” + token + “&pin=v” + String(virtual_pin) + “&value=” + float(value_to_send);
| ^~~~~~~~~~~
| server_path
exit status 1
‘server_name’ was not declared in this scope; did you mean ‘server_path’?

The two links in post #8 - the original one for the ESP32 and the second one which modifies that code to work for the ESP8266 in an Edgent sketch.

You’ve clearly followed at least one of them as you’ve copied pieces of my code from there - and created some issues for yourself in the process by not copying all of the relevant pieces.

This error is caused because you didn’t bother to copy the line that begins String server_name =

Pete.

Copy

  // Your Domain name with URL path or IP address with path
  http.begin(my_wifi_client, server_path.c_str());

Это должно быть внутри функции api_bridge, или в другом месте.
Я не программист, я не знаю как правильно работать с интернетом.

You appear to be referring to the code snippets from the top of this post…

These snippets of code outline a modification made to the full sketch that follows, because of a change in the way that the ESP8266 core works from version 3.0.x onwards.

Below these snippets of code, after the words “[END OF 14th January 2022 EDIT]]”, there is a full working Edgent .ino sketch.

If you aren’t able to take this working sketch and modify it to suit your purposes then I can’t really help you any further.

Pete.

Для начала я пытаюсь заставить работать этот код по ссылке. Он компилируется, загружается, но ничего не делает. В порт приходит это и что ???
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/ v1.0.1 on ESP8266

[393] --------------------------
[396] Product: Колонка
[399] Firmware: 0.1.0 (build Aug 26 2022 01:14:26)
[403] Device: ESP8266 @ 80MHz
[406] MAC: 80:7D:3A:3C:33:D0
[409] Flash: 4096K
[411] ESP core: 3.0.2
[413] ESP SDK: 2.2.2-dev(38a443e)
[416] Boot Ver: 6
[418] Boot Mode:1
[420] FW info: 474240/1622016, MD5:b238879f8dd10cc519fbbda7f8d02599
[630] Free mem: 30288
[630] --------------------------
[630] INIT => WAIT_CONFIG
[1240] AP SSID: Blynk Колонка-19A3A
[1241] AP IP: 192.168.137.99
[1241] AP URL: blynk.setup

Возможно из-за большого количества диалогов вы не правильно понимаете что я хочу сделать.
Мне надо на ESP8266, которая должна подключится к Wi-Fi, отправить в интернет вот такое:
https://fra1.blynk.cloud/external/api/update?token={token}&v16=1
Больше мне ничего не надо, не в порт печатать (пины Serial заняты), не куда то ещё что то…
Кажется что функция api_bridge как раз это и делает вот именно это мне и надо.
Обязательно чтоб в папке со скетчем было всё это?
изображение_2022-08-26_012639636
Скетч из примера компилируется, но если я вставляю весь это хлам в свой проект, выходит миллион ошибок. Это всё после обновления библиотеки на новую (3,0,3)

You need to provision the device via the app, by choosing “+ Add Device” and following the instructions.

If you don’t want the Edgent functionality in your sketch then you’re probably better taking the ESP32 example (which doesn’t use Edgent) and modifying it to work on the ESP8266 (not difficult if you compare the two sketches and read the January 14th 2022 update too.

Pete.

Я кажется предельно просто сказал что мне нужно. Ещё раз повторю:
Мне нужно отправить эту строку https://fra1.blynk.cloud/external/api/update?token={token}&v16=1 в интернет. Я не знаю как проще объяснить это. В интернет браузере эта строка вставляется в адресную строку и нажимается клавиша “enter”. То же самое, и именно тоже самое, мне надо сделать на ESP6288. Если я не знаю как это сделать, то именно поэтому я обратился сюда за помощью. Как я могу знать нужен мне Агент или ещё что то? Я понятия не имею что или кто для этого нужен. Ну не знаю я как проще объяснить чтоб понятно было.

That’s exactly what my two code examples do, one uses the ESP32 HTTP Client and is a non-Edgent example. The other uses the ESP8266 HTTP client and is an Edgent example.

If you aren’t able to take these building blocks and use them for your own purposes then maybe you need to improve your C++ coding skills or pay someone to do the coding work for you?

Pete.

ОК. Вот минимальный рабочий код и сейчас это работает без каких либо дополнений и включений.

#define BLYNK_TEMPLATE_ID "TEMPLATE_ID"
#define BLYNK_DEVICE_NAME "DEVICE_NAME"
#define BLYNK_AUTH_TOKEN "TOKEN"
#define BLYNK_AUTH_TOKEN2 "TOKEN_1"
#define BLYNK_FIRMWARE_VERSION        "0.1.0"
//#define BLYNK_PRINT Serial
//#define APP_DEBUG
//#define USE_NODE_MCU_BOARD


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266HTTPClient.h>

String server_name = "http://fra1.blynk.cloud/external/api/";
char auth[] = BLYNK_AUTH_TOKEN;
char auth2[] = BLYNK_AUTH_TOKEN2;

char ssid[] = "SSID";
char pass[] = "PASS";

void setup() {
 Blynk.begin(auth, ssid, pass);
}
void loop() {
  Blynk.run();
 if(...) 
 api_bridge(auth2, V16, valv);
}  // end loop

//********************************* BLYNK *****************************
void api_bridge(String token, int virtual_pin, float value_to_send)
{
  WiFiClient client; 
  HTTPClient http;
  String server_path = server_name + "update?token=" + token + "&pin=v" + String(virtual_pin) + "&value=" +  float(value_to_send);
  http.begin(client,server_path.c_str());  
  long request_time = millis();
  int httpResponseCode = http.GET();
  http.end();
}
//********************************* END BLYNK *************************

Но правильно ли я понял, что это работает только до конца года, и потом работать перестанет? Это так?

No, that is 100% wrong.

Blynk Legacy using the Legacy cloud servers will stop working at the end of the year.

This is Blynk IoT code, using the IoT servers and is the replacement for Blynk Legacy.

This code will continue to work for the foreseeable future.

Pete.

1 Like

Ок, я понял. Спасибо за помощь. У меня получилось сделать то, что мне надо было.

In 1-2 weeks we’ll introduce “Forwarding automation” that will allow you to forward data between different devices that are connected to the Blynk server without coding. It’s some kind of bridge replacement.

4 Likes

That’s great news.