// TD-ARDUINO // test des sliders // 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 "TMPLAk...vT-" #define BLYNK_DEVICE_NAME "Puzzle Template" #define BLYNK_AUTH_TOKEN "gwHBXdz...D2on9H5xz" // Comment this out to disable prints and save space #define BLYNK_PRINT Serial #include #include #include char auth[] = BLYNK_AUTH_TOKEN; // Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "MONSSID"; char pass[] = "monmotdepasse"; //const char* ssid = SECRET_SSID; // your network SSID (name) //const char* password = SECRET_PSWD; // your network password //char auth[] = SECRET_TOKEN; // your Blynk API token // Variables to store the combination value // Set the intitial combination to ( 1 1 1 ) int SliderValueOne = 1; int SliderValueTwo = 1; int SliderValueThree = 1; // Blynk functions to retrive values BLYNK_WRITE(V1) { SliderValueOne = param.asInt(); // assigning incoming value from pin V1 to a variable } BLYNK_WRITE(V2) { SliderValueTwo = param.asInt(); // assigning incoming value from pin V1 to a variable } BLYNK_WRITE(V3) { SliderValueThree = param.asInt(); // assigning incoming value from pin V1 to a variable } void setup() { Serial.begin(9600); Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass); // start Blynk functionalities and connect to WiFi } void loop() { // Variambles to temporarily store the combination int Temp_Slider_One_value = SliderValueOne; int Temp_Slider_Two_value = SliderValueTwo; int Temp_Slider_Three_value = SliderValueThree; Blynk.run(); // poll new combination values from the online app // check if combination values are changed and print them on the console if(Temp_Slider_One_value != SliderValueOne || Temp_Slider_Two_value != SliderValueTwo || Temp_Slider_Three_value != SliderValueThree){ Serial.print("New combination: "); Serial.print(SliderValueOne); Serial.print(" "); Serial.print(SliderValueTwo); Serial.print(" "); Serial.println(SliderValueThree); } }