Skip to content

Instantly share code, notes, and snippets.

@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']))
@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 / 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"
/*
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 / 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
@AgustinPelaez
AgustinPelaez / post_linkit_collection.ino
Last active September 2, 2015 05:16
Send a collection of values to Ubidots using Liknit One WiFi
/*
Ubidots WiFi client
This sketch reads analog inputs and sends the values to Ubidots
Change the macro WIFI_AP, WIFI_PASSWORD, WIFI_AUTH, URL, TOKEN and VARIABLE_ID accordingly.
based on the Web Client example created 13 July 2010
by dlf (Metodo2 srl)
modified 31 May 2012
@AgustinPelaez
AgustinPelaez / post3vales.ino
Created July 16, 2015 23:06
Código WiDo - Mariano
/***************************************************
* This is an example for the DFRobot Wido - Wifi Integrated IoT lite sensor and control node
* Product Page & More info: http://www.dfrobot.com/index.php?route=product/product&product_id=1159
* Designed specifically to work with the DFRobot Wido products:
*
* The library is forked from Adafruit
*
* Contributed by James
* BSD license, all text above must be included in any redistribution
* Modified by Agustin Pelaez for Ubidots, Inc.
<?xml version="1.0" encoding="utf-8" ?>
<Driver xmlns="http://code.google.com/p/open-zwave/" version="3" home_id="0x0184e19a" node_id="1" api_capabilities="8" controller_capabilities="8" poll_interval="30000" poll_interval_between="false">
<Node id="1" name="Hello name" location="Hello location" basic="2" generic="2" specific="1" type="Static PC Controller" listening="true" frequentListening="false" beaming="true" routing="false" max_baud_rate="40000" version="3" query_stage="Complete">
<Manufacturer id="0086" name="Aeon Labs">
<Product type="0002" id="0001" name="Z-Stick S2" />
</Manufacturer>
<CommandClasses>
<CommandClass id="32" name="COMMAND_CLASS_BASIC" version="1" after_mark="true">
<Instance index="1" />
<Value type="byte" genre="basic" instance="1" index="0" label="Basic" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="255" value="0" />
@AgustinPelaez
AgustinPelaez / webclient_ubidots.ino
Last active August 29, 2015 14:23
A test code for the Adafruit CC3000 breakout, based on their "WebClient.ino" example at: https://github.com/adafruit/Adafruit_CC3000_Library
/***************************************************
This is an example for the Adafruit CC3000 Wifi Breakout & Shield
Designed specifically to work with the Adafruit WiFi products:
----> https://www.adafruit.com/products/1469
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
@AgustinPelaez
AgustinPelaez / zwave_hem_to_ubidots.py
Created June 5, 2015 03:22
A Python Script to read a Z Wave Home Energy Meter using the library: http://github.com/OpenZWave/python-openzwave
#!/usr/bin/env python
import logging
import ubidots
import sys, os
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('openzwave')