Skip to content

Instantly share code, notes, and snippets.

View jeanfbrito's full-sized avatar
🌱
Seeding the future!

Jean Brito jeanfbrito

🌱
Seeding the future!
View GitHub Profile
@jeanfbrito
jeanfbrito / main.js
Created February 17, 2016 17:04
Xadow ADXL345 + OLED display working
// Load accelerometer
var adxl345 = require('jsupm_adxl345');
// Instantiate on I2C bus
var adxl = new adxl345.Adxl345(0);
// Initialize the hardware device
var screen = new (require("jsupm_i2clcd").SSD1308)(0, 0x3C);
// Displays a message on the OLED display
@jeanfbrito
jeanfbrito / mosquitto3.lua
Created February 1, 2016 04:41
Estufa v0.3
-- Your access point's SSID and password
local SSID = "greenhouse"
local SSID_PASSWORD = "senhasupersecreta"
local DEVICE = "undefined"
local timesRunned = 0
SDA_PIN = 6 -- sda pin, GPIO12
SCL_PIN = 5 -- scl pin, GPIO14
-- configure ESP as a station
-- Your access point's SSID and password
local SSID = "greenhouse"
local SSID_PASSWORD = "senhasupersecreta"
local DEVICE = "undefined"
local temperature = 27.5
local timesRunned = 0
-- configure ESP as a station
wifi.setmode(wifi.STATION)
wifi.sta.config(SSID,SSID_PASSWORD)
// The received message is stored in 'msg'
// It will have at least a 'payload' property:
// console.log(msg.payload);
// The 'context' object is available to store state
// between invocations of the function
// context = {};
//expects JSON payload and destination specified in topic
var key = "your api key here";
@jeanfbrito
jeanfbrito / influxdb.lua
Created January 6, 2016 18:41
NodeMCU and InfluxDB
-- Your access point's SSID and password
local SSID = "greenhouse"
local SSID_PASSWORD = "senhasupersecreta"
local DEVICE = "device001"
local temperature = 27.5
-- configure ESP as a station
wifi.setmode(wifi.STATION)
wifi.sta.config(SSID,SSID_PASSWORD)
wifi.sta.autoconnect(1)
@jeanfbrito
jeanfbrito / init.lua
Created November 30, 2015 18:44
Sensor da Estufa V0.1
--- Config
SSID = "Dark side of the Force"
PASSWORD = "senhasupersecreta"
TIMEOUT = 30000000 -- 30s
--- Station modes
STAMODE = {
STATION_IDLE = 0,
STATION_CONNECTING = 1,
STATION_WRONG_PASSWORD = 2,
@jeanfbrito
jeanfbrito / bh1750.lua
Last active February 1, 2016 03:49
ESP8266 BH1750FVI Test
-- ***************************************************************************
-- BH1750 module for ESP8266 with nodeMCU
-- BH1750 compatible tested 2015-1-22
--
-- Written by xiaohu
--
-- MIT license, http://opensource.org/licenses/MIT
-- ***************************************************************************
local moduleName = ...
local M = {}
@jeanfbrito
jeanfbrito / init.lua
Last active November 30, 2015 16:35
NodeMCU DHT22 test
pin = 4
status,temp,humi,temp_decimial,humi_decimial = dht.read(pin)
if( status == dht.OK ) then
-- Integer firmware using this example
print(
string.format(
"DHT Temperature:%d.%03d;Humidity:%d.%03d\r\n",
math.floor(temp),
temp_decimial,
math.floor(humi),
@jeanfbrito
jeanfbrito / Symlinks for me
Created October 18, 2015 06:57
Symlinks for my personal use
@jeanfbrito
jeanfbrito / lm35-to-thingspeak.lua
Created October 12, 2015 20:59 — forked from rock3m/lm35-to-thingspeak.lua
Detecting the indoor temperature using LM35, and send the periodic recordings to ThingSpeak via WiFi. See project details at https://medium.com/grace-learns-iot/day-7-monitoring-home-temperature-on-the-internet-26c175ee7200
--- Config
SSID = "YOUR_WIFI_NAME"
PASSWORD = "YOUR_WIFI_PASSWORD"
TIMEOUT = 30000000 -- 30s
--- Station modes
STAMODE = {
STATION_IDLE = 0,
STATION_CONNECTING = 1,
STATION_WRONG_PASSWORD = 2,