Skip to content

Instantly share code, notes, and snippets.

/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
/****************************************
* Define Constants
****************************************/
#define TOKEN "...." // Your Ubidots TOKEN
#define WIFINAME "...." //Your SSID
/****************************************
* Include Libraries
****************************************/
#include <PubSubClient.h>
#include <SPI.h>
#include <WiFi.h>
/****************************************
* Define Your Wi-Fi crendetials
****************************************/
/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
#include <Servo.h>
/****************************************
* Define Constants
****************************************/
#define TOKEN "assign_your_ubidots_token" // Your Ubidots TOKEN
/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
#include <map>
/****************************************
* Define Constants
****************************************/
#define TOKEN "..." // Your Ubidots TOKEN
/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
#include <OneWire.h>
#include <DallasTemperature.h>
/****************************************
* Define Constants
****************************************/
#define TOKEN "....." // Your Ubidots TOKEN
/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
/****************************************
* Define Constants
****************************************/
#define TOKEN "..." // Your Ubidots TOKEN
#define WIFINAME "..." //Your SSID
@ubi-gists
ubi-gists / PetAutomaticDispenser
Last active May 22, 2017 20:02
Pet-Automatic-Dispenser
/********************************************************************************
* This code is to control the servo of the
* Pet Automaic Dispenser
* nodeMCU pins:
* 3v3 --> Red wire of the servo
* GND --> Black wire of the servo
* 5(D1)--> Yellow o white wire of the servo
* Created 28 Octubre 2016
* by María Hernandez
* Public code.
/*
* The sample code requires the ESP8266 v.2.0.0 library for proper operation.
* (https://github.com/ubidots/ubidots-esp8266/releases/tag/2.0.0)
* However, is strongly recommended to migrate the code to the latest library version.
* (https://github.com/ubidots/ubidots-esp8266)
*/
#include "DHT.h"
#include "UbidotsMicroESP8266.h"
[{"id":"1dc93aec.27a665","type":"mqtt-broker","z":"5600d8f5.a42228","broker":"things.ubidots.com","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willRetain":null,"willPayload":"","birthTopic":"","birthQos":"0","birthRetain":null,"birthPayload":""},{"id":"bf41b1b8.c3d03","type":"mqtt out","z":"5600d8f5.a42228","name":"","topic":"","qos":"1","retain":"","broker":"1dc93aec.27a665","x":524,"y":292,"wires":[]},{"id":"d5607a01.4326a8","type":"bbb-analogue-in","z":"5600d8f5.a42228","pin":"P9_39","topic":"","breakpoints":[{"input":0,"output":0,"mutable":false},{"input":1,"output":1,"mutable":false}],"averaging":false,"name":"Analog Pin 0","x":366,"y":261,"wires":[["f8cbc76e.347e68"]]},{"id":"964042fa.b6bb8","type":"inject","z":"5600d8f5.a42228","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"4","crontab":"","once":true,"x":220,"y":261,"wires":[["d5607a01.4326a8"]]},{"id":"f8cbc76e.347e68","typ
/*
* The sample code requires the ESP8266 v.2.0.0 library for proper operation.
* (https://github.com/ubidots/ubidots-esp8266/releases/tag/2.0.0)
* However, is strongly recommended to migrate the code to the latest library version.
* (https://github.com/ubidots/ubidots-esp8266)
*/
#include "UbidotsMicroESP8266.h"
#define ID "Your_variable_ID_here" // Put here your Ubidots variable ID
#define TOKEN "Your_token_here" // Put here your Ubidots TOKEN