Skip to content

Instantly share code, notes, and snippets.

View smukkejohan's full-sized avatar

Johan Bichel Lindegaard smukkejohan

View GitHub Profile
@smukkejohan
smukkejohan / main.cpp
Created May 10, 2024 11:08
rotary-encoder-teensy3.5
#include "Arduino.h"
// Written by Johan Bichel Lindegaard <[email protected]>
int aPin = 19;
int bPin = 20;
long lastPosition = 0;
long position = 0;
// values based on calibration with min max A: 8 26 B: 8 31
@smukkejohan
smukkejohan / redis.js
Created June 1, 2022 14:58
Persistent store with events
import Redis from "ioredis";
import EventBus from 'js-event-bus';
//import { persistBus } from './routes/admin/_persist-bus';
let bus = EventBus();
const redisConfig = {
segment: 'nyhedshjul'
}
if(process.env.REDIS_SENTINELS && process.env.REDIS_SENTINELS.indexOf(';') > 0){
// a string stariting with the name of the group, a semicolon, followed by sentinels in the format host:port, seperated by commas:
@smukkejohan
smukkejohan / main.cpp
Last active September 27, 2020 19:12
ESP8266 direct serial connection with Teensy 3.5 DMJX 2020
#include <Arduino.h>
//**** Using a Teensy 3.5 to Connect an ESP8266 to USB Serial for use and testing with AT commands *******
#define SSID "insert_SSID" //name of wireless access point to connect to
#define PASS "insert_PASSWORD" //wifi password
#define RST_PIN 24 // Pull low to trigger reset
#define CH_PD_PIN 25 // Pull high for AT command mode, low for firmware flash mode
#define TX_LED_PIN 14 // YELLOW LED - SENDING
#define RX_LED_PIN 15 // RED LED - RECEIVING
@smukkejohan
smukkejohan / main.cpp
Last active September 27, 2020 19:17
Using a Teensy 3.5 with ESP8266 to host a webserver and connect to a wifi network DMJX 2020
//**** Using a Teensy 3.5 to host a webserver on a wifi network using ESP8266 *******
#include <Arduino.h>
#define SSID "insert_SSID" //name of wireless access point to connect to
#define PASS "insert_password" //wifi password
#define RST_PIN 24 // Pull low to trigger reset
#define CH_PD_PIN 25 // Pull high for AT command mode, low for firmware flash mode
#define LED_PIN 14 // YELLOW LED - SENDING
@smukkejohan
smukkejohan / main.cpp
Created September 22, 2020 08:57
Debounce, analogRead and delay with timer DMJX 2020
#include <Arduino.h>
// Se https://learn.adafruit.com/make-it-switch/debouncing for nærmere beskrivelse
int ledPin = 3;
int buttonPin = 6;
unsigned long debounceTime = 5;
unsigned long lastDebounceTimestamp = 0;
@smukkejohan
smukkejohan / main.cpp
Created September 22, 2020 08:40
debounce and analogread dmjx example 2020
#include <Arduino.h>
// Se https://learn.adafruit.com/make-it-switch/debouncing for nærmere beskrivelse
int ledPin = 3;
int buttonPin = 6;
unsigned long debounceTime = 5;
unsigned long lastDebounceTimestamp = 0;
@smukkejohan
smukkejohan / main.cpp
Last active September 25, 2019 15:23
Sinuskurver til animation over tid uden delays
#include <Arduino.h>
//#define FASTLED_RGBW
//#include <FastLED.h>
#include <Adafruit_NeoPixel.h>
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1:
#define LED_PIN 6
// How many NeoPixels are attached to the Arduino?
@smukkejohan
smukkejohan / main.cpp
Created September 24, 2019 08:43
button with debounce and change of state with no delays DMJX
#include <Arduino.h>
int buttonPin = 2;
int ledPin = 13;
int buttonState = HIGH;
int lastButtonState = LOW;
int ledState = LOW;
bool blinkFast = true;
Started by user Johan Bichel Lindegaard
Building in workspace /var/lib/jenkins/workspace/Give Me A Break - Staging
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url [email protected]:dr-udsendelse/give-me-a-break.git # timeout=10
Fetching upstream changes from [email protected]:dr-udsendelse/give-me-a-break.git
> git --version # timeout=10
using GIT_SSH to set credentials
> git fetch --tags --progress [email protected]:dr-udsendelse/give-me-a-break.git +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/staging^{commit} # timeout=10
@smukkejohan
smukkejohan / ipp_test_json.json
Created January 24, 2019 10:15
ipp_test_json
{
"info": {
"identifier": "0000000000000",
"txDate": "2019-01-22T09:18:53",
"user": "drexjbil"
},
"buildSettings": {
"mainTemplate": "IPP",
"project": "DR2",
"projectPath": "../../AEAirlook/DR2_Nov17",