Skip to content

Instantly share code, notes, and snippets.

@AgustinPelaez
AgustinPelaez / chipkit_ubidots.ino
Created October 14, 2015 16:22
Read a value from Ubidots and display it an LED Matrix using a chipKIT Uno32.
#include <Wprogram.h>
#include <Wire.h>
#include <WiFiShieldOrPmodWiFi_G.h>
#include <DNETcK.h>
#include <DWIFIcK.h>
#include <LedControl.h>
//------------------------------End Libraries----------------------------------
#define GREEN 0
#define RED 1
/*
Web client
This sketch connects to a website through GPRS on LinkIt platform.
Specifically,
this example downloads the URL "http://arduino.cc/asciilogo.txt" and
prints it to the Serial monitor.
created 8 Mar 2012
by Tom Igoe
@AgustinPelaez
AgustinPelaez / MQTT_pubsub_example.ino
Last active February 5, 2020 04:53
MQTT nodeMCU with Ubidots
// MQTT-Ubidots example using Grove Temperature Sensor v1.2 in A0 and Grove Relay on D6 (pin 12)
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#define WIFISSID "wifi-ssid"
#define PASSWORD "IOT2016"
#define TOPIC1 "/v1.6/devices/motor/relay/lv"
#define TOPIC2 "/v1.6/devices/motor/temp"
@AgustinPelaez
AgustinPelaez / SendValues_MQTT_LinkitOne.ino
Created October 5, 2016 22:15
A simple MQTT sketch to upload values to Ubidots
#include <LWiFi.h>
#include <LWiFiClient.h>
#include <PubSubClient.h>
// These are the variables you will want to change based on your IOT data streaming account / provider
#define TOPIC "/v1.6/devices/YOUR-DEVICE-LABEL"
#define TOKEN "YOUR-UBIDOTS-TOKEN
#define WIFI_AP "UBIWIFI"
#define WIFI_PASSWORD "clave123456789ubi"
@AgustinPelaez
AgustinPelaez / geo_to_address.py
Last active August 27, 2017 05:09
A Dockerfile compatible Python script to be used with Openwhisk
#!/usr/bin/env python
from geopy.geocoders import Nominatim
import sys
import json
def main():
geolocator = Nominatim()
params = json.loads(sys.argv[1])
location = geolocator.reverse((params['lat'],params['lng']))