Skip to content

Instantly share code, notes, and snippets.

Ames Bielenberg Ames

Block or report user

Report or block Ames

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Ames / mqtt_publish.lua
Last active Oct 24, 2016
Publishing to MQTT on NodeMCU
View mqtt_publish.lua
-- Publish a message to the MQTT Broker
"temp/0", -- topic name
tF, -- message payload
1, -- QOS level
1, -- retain
function(conn) -- on-send callback
Ames / mqtt_connect.lua
Created Jul 19, 2015
Connecting to MQTT on NodeMCU
View mqtt_connect.lua
-- Create an MQTT client with a 2m keep-alive interval.
client = mqtt.Client(wifi.sta.getmac(), 120)
-- Connect to the broker
"", -- broker hostname
1883, -- default MQTT port
0, -- no security
function(client) -- on-connect callback
print ("connected.")
Ames / wifi_setup.lua
Created Jul 19, 2015
Connecting to Wi-Fi on NodeMCU
View wifi_setup.lua
wifi.sta.autoconnect(1) -- connect on boot
Ames / ds18b20_example.lua
Created Jul 19, 2015
Reading temperature from ds18b20 on NodeMCU
View ds18b20_example.lua
-- Pin Mapping
gpio2 = 4
-- Prepare the Thermo Module
ds18b20 = require("ds18b20")
-- The 1-Wire protocol allows many sensors to communicate over the same wire.
-- If addr is nil, a search is performed and the first device is used.
addr = nil
You can’t perform that action at this time.