Skip to content

Instantly share code, notes, and snippets.

View reaper7's full-sized avatar

reaper7 reaper7

  • apress24.pl
  • Polska, Żary
View GitHub Profile
@reaper7
reaper7 / MqttClient.js
Created April 11, 2019 18:01
MqttClient.js
const mqtt = require("mqtt");
const Tools = require("./Tools");
const Vacuum = require("./miio/Vacuum");
const COMMANDS = {
turn_on: "turn_on",
return_to_base: "return_to_base",
stop: "stop",
clean_spot: "clean_spot",
@reaper7
reaper7 / MqttClient_with_log.js
Created April 11, 2019 17:59
MqttClient_with_log.js
const mqtt = require("mqtt");
const Tools = require("./Tools");
const Vacuum = require("./miio/Vacuum");
const COMMANDS = {
turn_on: "turn_on",
return_to_base: "return_to_base",
stop: "stop",
clean_spot: "clean_spot",
@reaper7
reaper7 / MqttClient_old.js
Last active April 11, 2019 17:53
custom command support propose
const mqtt = require("mqtt");
const Tools = require("./Tools");
const Vacuum = require("./miio/Vacuum");
const COMMANDS = {
turn_on: "turn_on",
return_to_base: "return_to_base",
stop: "stop",
clean_spot: "clean_spot",

Installing Python 3.7.0 on Raspbian =================================

As of July 2018, Raspbian does not yet include the latest Python release, Python 3.7.0 This means we will have to build it ourselves, and here is how to do it.

  1. Install the required build-tools (some might already be installed on your system).

@reaper7
reaper7 / apps.ino
Last active March 24, 2018 06:00
M5StackSAM MAX17043 1-Cell Fuel Gauge App
// MAX17043 1-Cell Fuel Gauge
// APP for https://github.com/tomsuch/M5StackSAM
void appAccuMeter(){
MyMenu.drawAppMenu(F("ACCU METER"),F(""),F("ESC"),F(""));
const int MAX17043ADDR=0x36;
const int MAX17043CMDADDR=0xFE;
const int MAX17043SOCADDR=0x04;
const int MAX17043VCELLADDR=0x02;
time_t tmp_tmr;
double soc, volt;
@reaper7
reaper7 / gist:056ecc2b428940c4026953eabce075ce
Created October 26, 2017 12:43 — forked from mattfelsen/gist:9467420
Splitting strings by a delimiter for Arduino
//
// This is tested and works!
//
String input = "123,456";
int firstVal, secondVal;
for (int i = 0; i < input.length(); i++) {
if (input.substring(i, i+1) == ",") {
firstVal = input.substring(0, i).toInt();
secondVal = input.substring(i+1).toInt();
@reaper7
reaper7 / queue_from_esp_sdk.ino
Created October 19, 2017 12:43
queue from esp sdk
#if defined ( ESP8266 )
#include <queue.h>
#elif defined ( ESP32 )
#include <sys/queue.h>
#endif
struct tailq_entry {
uint32_t value;
char mytext[2];
bool stat;