i erased all “led” and “lcd”.
void setup()
{
// Debug console
pinMode (RELAY,OUTPUT);
digitalWrite(RELAY,LOW);
Serial.begin(115200);
delay(100);
pinMode(SDCARD_CS, OUTPUT);
digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
Blynk.begin(auth);
// You can also specify server:
//Blynk.begin(auth, "blynk.cloud", 80);
//Blynk.begin(auth, IPAddress(192,168,1,100), 8080);
// Setup a function to be called every second
//timer.setInterval(1000L, myTimerEvent);
//delay(100);
timer.setInterval(1000L, sendUpTEMPERATURE);
}
i think, my SD card is inactive and it is before my Blynk.begin command.
if i dont use, i cleared all of them.
i think, i cant understand…
i erased the button, i won’t use. i think, i can use buton or slider, but it is not succes. so i can only use the slider.
generally, i think, i solved the problems, isn’t t? please let me know if there is something I did not do or did not understand.
My sketch’s last version is ;
/*************************************************************
This is a simple demo of sending and receiving some data.
Be sure to check out other examples!
*************************************************************/
// Template ID, Device Name and Auth Token are provided by the Blynk.Cloud
// See the Device Info tab, or Template settings
#define BLYNK_TEMPLATE_ID "TMPLPtDx9eoi"
#define BLYNK_DEVICE_NAME "MY SWEET HOME"
#define BLYNK_AUTH_TOKEN "**"
// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
char auth[] = BLYNK_AUTH_TOKEN;
#define W5100_CS 10
#define SDCARD_CS 4
#define RELAY 9
float VOLTAGE = 0;
float TEMPERATURE = 0;
float SET_TEMP = 0;
int INCOMING_DATA = 0;
const int LM35 = A0;
int UpdateFrequency = 5000L;
int Hysteresis = 1;
BlynkTimer timer;
bool result = Blynk.connected();
// This function is called every time the Virtual Pin 0 state changes
/*
BLYNK_WRITE(V0)
{
// Set incoming value from pin V0 to a variable
int value = param.asInt();
// Update state
Blynk.virtualWrite(V1, value);
}
*/
BLYNK_WRITE(V10)
{
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
Serial.print("V10 Slider value is: ");
Serial.println(pinValue);
}
void sendUpTEMPERATURE()
{
INCOMING_DATA = analogRead(A0);
VOLTAGE = (INCOMING_DATA / 1023.0) * 5000;
TEMPERATURE = VOLTAGE / 10.0;
Blynk.virtualWrite(V15, TEMPERATURE);
Serial.print("Room Temperature: ");
Serial.println(TEMPERATURE);
if (SET_TEMP < TEMPERATURE)
{
digitalWrite(RELAY,LOW);
}
if (SET_TEMP >= (TEMPERATURE + Hysteresis))
{
digitalWrite(RELAY,HIGH);
//Serial.print("KOMBI YANIYOR");
}
if (TEMPERATURE > SET_TEMP)
{
digitalWrite(RELAY,LOW);
}
if (TEMPERATURE < 18)
{
//Blynk.notify("ODA ISISI ÇOK DÜŞÜK, KONTROL ET!!");
}
}
// This function is called every time the device is connected to the Blynk.Cloud
BLYNK_CONNECTED()
{
// Change Web Link Button message to "Congratulations!"
Blynk.syncAll();
}
// This function sends Arduino's uptime every second to Virtual Pin 2.
/*
void myTimerEvent()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
//if (V0 == HIGH)
//{
Blynk.virtualWrite(V2, millis() / 1000);
//}
}
*/
void setup()
{
// Debug console
pinMode (RELAY,OUTPUT);
digitalWrite(RELAY,LOW);
Serial.begin(115200);
delay(100);
pinMode(SDCARD_CS, OUTPUT);
digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
Blynk.begin(auth);
// You can also specify server:
//Blynk.begin(auth, "blynk.cloud", 80);
//Blynk.begin(auth, IPAddress(192,168,1,100), 8080);
// Setup a function to be called every second
//timer.setInterval(1000L, myTimerEvent);
//delay(100);
timer.setInterval(1000L, sendUpTEMPERATURE);
}
void loop()
{
Blynk.run();
timer.run();
if(Blynk.connected() == false)
{
digitalWrite(RELAY,LOW);
Blynk.connect();
}
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}
please check it for me and return to me.