Skip to content

Instantly share code, notes, and snippets.

View dniklaus's full-sized avatar

Dieter Niklaus dniklaus

View GitHub Profile
@dniklaus
dniklaus / TTN-Temperature-Decoder.js
Last active October 25, 2019 23:53
https://github.com/ERNICommunity/hnh19ech-iot sends 2 bytes to TTN: temperature [ °C ], byte[0]: integer part, byte[1]: fraction (1/100 °C)
var bytesToInt = function(bytes) {
var i = 0;
for (var x = 0; x < bytes.length; x++) {
i |= +(bytes[x] << (x * 8));
}
return i;
};
var unixtime = function(bytes) {
if (bytes.length !== unixtime.BYTES) {
@dniklaus
dniklaus / testLoraKey.cpp
Last active November 24, 2018 09:07
LoRaKey string to byte array conversion
//============================================================================
// Name : testLoraKey.cpp
// Author : nid
//============================================================================
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <stdio.h>
@drjazz2099
drjazz2099 / matrixCode
Created May 15, 2016 17:52
Arkathon stuff
#include <Adafruit_GFX.h>
#include <gfxfont.h>
// Adafruit_NeoMatrix example for single NeoPixel Shield.
// Scrolls 'Howdy' across the matrix in a portrait (vertical) orientation.
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
#include "CapSensor.h"
#include "Timer.h"
#include "Arduino.h"
#include <Adafruit_CAP1188.h>
const int CapSensor::s_defaultKeyPollTime = 50;
//-----------------------------------------------------------------------------
class MyDebounceTimerAdatper : public TimerAdapter
/**
* Micro-Professor MPF-1 Tape File generator based on Arduino.
*
* Arduino Sketch: MPF_1_TapeFileGen
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
@dniklaus
dniklaus / MultipleTimerExample.ino
Last active April 19, 2018 08:55
This Arduino Sketch demonstrates the Timer library usage when multiple timers have to run concurrently.
/**
* This Arduino Sketch demonstrates the Timer library usage when multiple timers have to run concurrently.
* The Timer library can be along with its documentation can be found here:
* [wiring-timer](https://github.com/dniklaus/wiring-timer)
*/
#include <Timer.h>
void func30s();
void func45s();
@asheeshr
asheeshr / ardprintf.c
Last active January 11, 2024 16:37
A printf function for serial communication from Arduino boards
/*
This code should be pasted within the files where this function is needed.
This function will not create any code conflicts.
The function call is similar to printf: ardprintf("Test %d %s", 25, "string");
To print the '%' character, use '%%'
This code was first posted on http://arduino.stackexchange.com/a/201
*/
@dspezia
dspezia / Makefile
Created February 23, 2012 15:50
Example of pipelining with hiredis
OBJ = genload.o
BINS = genload
CC=g++
OPTIMIZATION?=-O3
CFLAGS?=$(OPTIMIZATION) $(ARCH) $(PROF) -I ../hiredis
CCLINK?=-pthread
LDFLAGS?=-L../hiredis -lhiredis -lm
OBJ = example.o