Помогите обеденить ето Код (C++): #include <OneWire.h> #include <DallasTemperature.h> #define ONE_WIRE_BUS 13 // DS18B20 pin connect OneWire oneWire(ONE_WIRE_BUS); DallasTemperature DS18B20(&oneWire); void loop() { do { DS18B20.requestTemperatures(); tmp = DS18B20.getTempCByIndex(0); } while (tmp == 85.0 || tmp == (-127.0)); Blynk.virtualWrite(V3, tmp); } С етим Код (C++): #define BLYNK_PRINT Serial // Comment this out to disable prints and save space #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> // You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "YourAuthToken"; void setup() { Serial.begin(9600); Blynk.begin(auth, "ssid", "pass"); } void loop() { Blynk.run(); }
Код (C++): #define BLYNK_PRINT Serial #define ONE_WIRE_BUS 2 #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> #include <OneWire.h> #include <DallasTemperature.h> // You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "**************************"; // Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "############"; char pass[] = "###########"; OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); void setup() { // Debug console Serial.begin(9600); Blynk.begin(auth, ssid, pass); sensors.begin(); } void sendTemps() { sensors.requestTemperatures(); float temp = sensors.getTempCByIndex(0); Serial.println(temp); Blynk.virtualWrite(V1, temp); } void loop() { Blynk.run(); sendTemps(); }