Skip to content

Instantly share code, notes, and snippets.

// This #include statement was automatically added by the Particle IDE.
#include <Ubidots.h>
// This #include statement was automatically added by the Particle IDE.
#include <Current_Monitor.h>
#ifndef TOKEN
#define TOKEN "put_your_ubidots_token_here" // Put here your Ubidots TOKEN
#endif
/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
#include <OneWire.h>
#include <DallasTemperature.h>
/****************************************
* Define Constants
****************************************/
#define TOKEN "....." // Your Ubidots TOKEN
/*************************************************************************************************
* This example get the last value of a variable from the Ubidots Cloud(www.ubidots.com) to control
* a Led.
*
* Requirements:
* 1. In the Device section, create a new device called "control"
* 2. Into the device just created, create a new default variable called "led"
* 3. In the Dashboard section, create a new "switch" control widget to control the led :)
*
* IMPORTANT NOTE: Don't forget assign your WiFi credentials, ubidots token, and the pin where the
/*************************************************************************************************
* This Example sends harcoded data to Ubidots using a ESP32. The code sends a distance value
* between a device and its opposite endpoint to Ubidots, then the value will be managed in
* Ubidots to calculate the volume of a tank with the characteristics of your tank.
*
* This example is given AS IT IS without any warranty.
*
* Made by María Carlina Hernandez.
*************************************************************************************************/
/****************************************
* Include Libraries
****************************************/
#include <PubSubClient.h>
#include <SPI.h>
#include <WiFi.h>
/****************************************
* Define Your Wi-Fi crendetials
****************************************/
@ubi-gists
ubi-gists / UbidotsAPI_PubNub_BLOCKS.js
Last active June 1, 2017 02:16
Manages data between Ubidots and PubNub
// https://ubidots.com/docs/api/index.html
export default (request) => {
const xhr = require('xhr');
const queryStringCodec = require('codec/query_string');
const token = request.message.token || '';
const apiKey = request.message.apiKey || '';
const action = request.message.action;
const payload = request.message.payload;
const labelDevice = request.message.labelDevice;
const variableLabel = request.message.variableLabel;
@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.
// Made by: Maria Carlina Hernandez
/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
/****************************************
* Define Constants
****************************************/
#define TOKEN "..." // Your Ubidots TOKEN
#define WIFINAME "..." //Your SSID
/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
/****************************************
* Define Constants
****************************************/
#define TOKEN "...." // Your Ubidots TOKEN
#define WIFINAME "...." //Your SSID
/****************************************
* Include Libraries
****************************************/
#include "UbidotsESPMQTT.h"
#include <map>
/****************************************
* Define Constants
****************************************/
#define TOKEN "..." // Your Ubidots TOKEN