Skip to content

Instantly share code, notes, and snippets.

View dniklaus's full-sized avatar

Dieter Niklaus dniklaus

View GitHub Profile
@dniklaus
dniklaus / Feather9x_RX.ino
Created July 22, 2017 04:34
Adafruit Feather M0 LoRa, Basic RX & TX example, Receiver example code, source: https://learn.adafruit.com/adafruit-feather-m0-radio-with-lora-radio-module/using-the-rfm-9x-radio#
// Feather9x_RX
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messaging client (receiver)
// with the RH_RF95 class. RH_RF95 class does not provide for addressing or
// reliability, so you should only use RH_RF95 if you do not need the higher
// level messaging abilities.
// It is designed to work with the other example Feather9x_TX
#include <SPI.h>
#include <RH_RF95.h>
package dn;
import gnu.io.CommPort;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import gnu.io.SerialPortEvent;
import gnu.io.SerialPortEventListener;
import java.io.IOException;
import java.io.InputStream;
@dniklaus
dniklaus / DoubleStrobeBlink_with_Timer.cpp
Last active June 7, 2020 18:32
Double Strobe Blink with Timer
@dniklaus
dniklaus / sqrt-heron.cpp
Last active February 24, 2020 23:21
Square Root - iterative according to Heron
#include <iostream>
using namespace std;
int main()
{
int x = 10;
double a = 1.0 * x;
double l = 1.0;
const double eps = 0.000001;
@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>
@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();
@dniklaus
dniklaus / Thermometer.ino
Last active February 23, 2018 17:10
HnH-2016 / EDDCH1801, Tutorial "Hands-on Arduino", Thermometer application
#include <Timer.h>
#include <LcdKeypad.h>
/**************************************************************************/
/*!
This is a demo for the Adafruit MCP9808 breakout
----> http://www.adafruit.com/products/1782
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
@dniklaus
dniklaus / test.puml
Created October 10, 2017 05:27
Test Plantuml Gist
@startuml
Alice -> Bob: test
@enduml