Skip to content

Instantly share code, notes, and snippets.

hardware.pin9.configure(ANALOG_IN);
function getTemp() {
local supplyVoltage = hardware.voltage();
local voltage = supplyVoltage * hardware.pin9.read() / 65535.0;
local c = (voltage - 0.5) * 100 ;
local c_str = format("%.01f", c);
server.log("Current temp is "+c_str+" °C");

Keybase proof

I hereby claim:

  • I am kd8bxp on github.
  • I am kd8bxp (https://keybase.io/kd8bxp) on keybase.
  • I have a public key whose fingerprint is 9545 12FF F306 04E0 F6FB E4BB B6B7 DA61 5E5C 9A9D

To claim this, I am signing this object:

@kd8bxp
kd8bxp / 0_reuse_code.js
Created October 23, 2016 01:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kd8bxp
kd8bxp / say.py
Created June 13, 2017 01:52
Python Script for Raspberry PI Speech Synthesizer project
import paho.mqtt.client as paho
import os
device_id = '1'
device_secret = '1234'
random_client_id = '1234'
def on_connect(client, data, flags, rc):
print('Connected, rc: ' +str(rc))
@kd8bxp
kd8bxp / MQTTpublishSay.ino
Created June 13, 2017 03:00
MQTT publish for Raspberry PI Speech Synthesizer project
/*
Basic ESP8266 MQTT example
This sketch demonstrates the capabilities of the pubsub library in combination
with the ESP8266 board/library.
It connects to an MQTT server then:
- publishes "hello world" to the topic "outTopic" every two seconds
- subscribes to the topic "inTopic", printing out any messages
it receives. NB - it assumes the received payloads are strings not binary
@kd8bxp
kd8bxp / phpip.php
Created June 19, 2017 22:24
PHP script to SMS IP address using IFTTT
<?php
$filen = "ip.txt";
if (file_exists($filen)) {echo " script check file is Ok \r\n ";} else {$handle = fopen ($filen, "w"); fwrite($handle, "0");
fclose($handle); }
$handle=fopen($filen, 'r');
$check = trim(fgets($handle), "\r\n"); //last ip address
fclose ($handle);
$ip=exec("ifconfig wlp1s0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'"); //Dell Desktop
@kd8bxp
kd8bxp / esp8266chip_id
Created September 18, 2017 01:07
Create a Unique MQTT Client ID or SSID for your ESP8266 using part of the MAC address.
void setup() {
Serial.begin(9600);
Serial.println("");
Serial.println("");
Serial.println("Check ID in:");
Serial.println("https://www.wemos.cc/verify_products");
Serial.printf("Chip ID = %08X\n", ESP.getChipId());
Serial.println(ESP.getChipId());
Serial.println("");
Serial.println("");
@kd8bxp
kd8bxp / ESP32chip_id
Created September 18, 2017 01:14
Create a Unique MQTT Client ID or SSID for your ESP32 using part of the MAC address.
#include <WiFi.h>
#include <ESP32WebServer.h>
void setup()
{
Serial.begin(9600);
delay(10);
uint64_t chipid=ESP.getEfuseMac();//The chip ID is essentially its MAC address(length: 6 bytes).
@kd8bxp
kd8bxp / Console Output
Last active October 3, 2017 15:51
Errors out on me, not sure why.
irection: Backward. Count: 50
Direction: Backward. Count: 98
Direction: Backward. Count: 0
Direction: Backward. Count: 52
Direction: Backward. Count: 100
Direction: Backward. Count: 150
Direction: Backwa⸮Hl⸮k⸮D6⸮⸮Z⸮<⸮⸮Direction: Backward. Count: 38
Direction: Backward. Count: 82
Direction: Backward. Count: 0
Direction: Backward. Count: 52
/* Modified by LeRoy Miller (c) 2017, modification shows how to do the base project with just one Arduino UNO
*
* Highly based on https://www.instructables.com/id/Add-Lights-and-Spooky-Music-to-Your-Jack-O-Lantern/
* By More than the Sum
*
*/
#include <Adafruit_NeoPixel.h>
#include <TimedAction.h>