Skip to content

Instantly share code, notes, and snippets.

Lukelectro / E-ink spielerei
Last active Jul 18, 2020
E-Ink ED060SC7 differs from ...SC4 (Swap X & Y). STM32F103 has less RAM, so only Proof of Concept.
View E-ink spielerei
[empty file, added to change gist title]
Lukelectro /
Created Jun 6, 2019 — forked from marians/
How to read data from SDS011 sensor via USB serial connection, from
# Anpassung für big endian unter RHEL 7
while true; do
stty -F /dev/ttyUSB0 9600 raw
INPUT=$(dd conv=swab bs=10 count=1 </dev/ttyUSB0 2>/dev/null | od -x -N10 |head -n 1|cut -f2-10 -d" ");
#echo $INPUT
Lukelectro / mainsspy_main.c
Created Dec 31, 2018
work in progress. Sensor that monitors mains voltage / wheter a appliance is turned off or not, sends ID every nn s and/or goodbye at powerdown.
View mainsspy_main.c
// MainsSensor.
// doel: op zuinige attiny (attiny10? attiny45?) bij opstarten en elke paar minuten op 433Mhz eigen ID zenden, en bij wegvallen van de voeding een afmeldbericht sturen (Met de energie uit een elco) met datzelfde ID.
// PORTB1 data output
// PORTB2 = INT0 watch powerloss (same pin on both t45 and t10)
#define t45
//#define t10
// TODO: Please note: do not forget to edit the makefile as well when changing MCU between attiny45 and attiny10 (in 2 places), and when using t45, set its fuses correctly.
View morse.ino
#include <ctype.h>
const int sp = 0; // speaker pin
char tekst[] = "pas wijze lynx bezag vroom het fikse aquaduct 1234567890"; // test tekst
const int mlen = 80; // morse length
void setup() {
// put your setup code here, to run once:
View GroteSchakelaar.Ino
Basic ESP8266 MQTT example, editted for "Grote Schakelaar". REMINDER: PAS DE NETWERKINSTELLINGEN AAN! En zet de topics goed. (En soldeer even een bordje maar dat is minder vergeetbaar)
It connects to an MQTT server then:
- subscribes to the topic "inTopic", printing out any messages
it receives. NB - it assumes the received payloads are strings not binary
- If the first character of the topic "inTopic" is an 1, switch ON the ESP Led,
else switch it off
- Publishes to a topic set below a value set below (hardcoded)
View Draaischijf_indexer.ino
#define STEPSPERROT (200)
#define MICROSTEPS (16)
#define INTERVALS (512)
#define MAGNETIZETIME (200) // miliseconds the magnet is powered. Hint from Aart: short, high current pulses (dump a capacitor) work best.
#define LEDPIN 17 // not 13 on pro micro, but 17
//#define DEBUG
Lukelectro / randomgepruts.ino
Created Nov 5, 2017
Attempt at random number generation with noise from last bit of ADC read, for seeding pseudorandom generator. For STM32F103 board.
View randomgepruts.ino
#define debug
void setup() {
// put your setup code here, to run once:
//analogReadResolution(12); // STM32F103, 12 bits adc resolution // Allwrong, this should work but doesn't. Fortunately, in contrast to documentation, a 12 bit result turns out te be the default on this board.
void loop() {
// put your main code here, to run repeatedly: