Skip to content

Instantly share code, notes, and snippets.

/**
Latency measurement code -- measurement jig
Simple tool to toggle a digital pin and measure the delay until
the desired response happens. The function of the digital output,
and the signal to be measured, are determined by whatever external
hardware is attached.
The resulting delay in microseconds is printed over the serial port
so multiple trials can be made into a histogram. The granularity of
Webmapper console (debug enabled):
-- <network> got /unmapped testdev.1/testOut <- testOutDev.1/testIn @id
-- <network> got /signal testdev.1:testOut
-- <database> updated 1 properties for signal 'testdev.1:testOut'.
-- <network> got /unmapped testOutDev.1/testIn -> testdev.1/testOut @id
-- <network> got /unmapped testdev.1/testOut <- testOutDev.1/testIn @id
-- <network> got /device testOutDev.1 + 20 arguments
-- <database> updated 1 properties for device 'testOutDev.1'.
-- <network> got /signal testOutDev.1:testIn
@johnty
johnty / weather-chart-flow.js
Created May 17, 2019 02:05
node-red openweathermap and chartjs dashboard example
[
{
"id": "f1283496.99fa28",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": ""
},
{
"id": "87ffda01.2a7e98",
@johnty
johnty / testcpp.cpp
Last active February 28, 2019 09:00
libapper cpp test
#include <cstring>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <array>
#include "config.h"
#include <mapper/mapper_cpp.h>
#!/usr/bin/env python
from __future__ import print_function
from collections import deque
import sys, mapper
import numpy as np
start = mapper.timetag()
d1 = deque()
# dec/06/2018 14:01:09 by RouterOS 6.43.7
# software id = YFCZ-M364
#
# model = RouterBOARD 941-2nD
# serial number = 6617056BECC9
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
add authentication-types=wpa-psk,wpa2-psk management-protection=allowed mode=dynamic-keys name=wifi_wpa supplicant-identity=MikroTik wpa-pre-shared-key=xxxx \
wpa2-pre-shared-key=xxxx
/interface wireless
#include <WiFi.h>
#include <WiFiUdp.h>
WiFiUDP udp;
const char * ssid = "SSID";
const char * password = "PASS";
boolean connected = false;
void setup()
{
[
{
"id":"ce73efbb.99435",
"type":"http in",
"z":"c31ab6fb.21e498",
"name":"",
"url":"/motion",
"method":"get",
"swaggerDoc":"",
"x":217,
/*
BLE_MIDI Example by neilbags
https://github.com/neilbags/arduino-esp32-BLE-MIDI
Based on BLE_notify example by Evandro Copercini.
Creates a BLE MIDI service and characteristic.
Once a client subscibes, send a MIDI message every 2 seconds
*/
@johnty
johnty / mqtt-roundtrip.json
Last active September 13, 2017 20:02
node-red mqtt roundtrip updated
[
{
"id": "c67af34f.cfd1",
"type": "function",
"z": "9b7d2645.a72f18",
"name": "deltaT",
"func": "\nvar prev = flow.get('prev')||0;\n\nvar d = new Date();\nvar n = d.getMilliseconds();\n\nif (msg.topic == \"timestamp\"){\n flow.set('prev', n);\n}\n \nelse {\n if (n<prev) {\n //console.log(\"OVERFLOW!\");\n n=n+1000;\n }\n //console.log(\"tDiff = \",n,\"-\",prev,\"=\",n-prev);\n console.log(n-prev);\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 382.5,