/* * Mini Kit Pan/Tilt SG90 + Wemos + Cayenne IoT (mydevices.com) * This program is free software: you can redistribute it and/or modify * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * Licence : MIT * Copyright (C) 2017 : www.projetsdiy.fr and www.diyprojects.io */ //#define CAYENNE_PRINT Serial #include #include // Vos paramètres de connexion WiFi - Your WiFi credentials. char ssid[] = "pk"; char pass[] = "Pavankumar69k"; // Cayenne authentication token. This should be obtained from the Cayenne Dashbo char username[] = "970c9a50-df1d-11e6-8577-0128e408a1ba"; char password[] = "fabbca13586b26942098cddb31182f97fde554ef"; char clientID[] = "28948ee0-1223-11e8-9beb-4d400e603e7e"; Servo pan; Servo tilt; Servo serv1; Servo serv2; CAYENNE_IN(1) { Serial.print("move Pan to "); double currentValue = getValue.asInt(); int position = currentValue ; Serial.println(position); pan.write(position); } CAYENNE_IN(2) { Serial.print("move Tilt to "); double currentValue = getValue.asInt(); int position = currentValue ; Serial.println(position); tilt.write(position); } CAYENNE_IN(3) { Serial.print("move Tilt to "); double currentValue = getValue.asInt(); int position = currentValue ; Serial.println(position); serv1.write(position); } CAYENNE_IN(4) { Serial.print("move Tilt to "); double currentValue = getValue.asInt(); int position = currentValue ; Serial.println(position); serv2.write(position); } void setup() { Serial.begin(115200); // See the connection status in Serial Monitor Cayenne.begin(username,password,clientID,ssid, pass); pan.attach(D5); tilt.attach(D6); serv1.attach(D3); serv1.attach(D1); } void loop() { Cayenne.loop(); }