Skip to content

Instantly share code, notes, and snippets.

View PaulStoffregen's full-sized avatar

Paul Stoffregen PaulStoffregen

View GitHub Profile
// Demo video: https://www.youtube.com/watch?v=mbqrDqTsEf0
#include <Audio.h>
AudioInputAnalog audioIn;
AudioAnalyzeToneDetect row1; // 7 tone detectors are needed
AudioAnalyzeToneDetect row2; // to receive DTMF dial tones
AudioAnalyzeToneDetect row3;
AudioAnalyzeToneDetect row4;
AudioAnalyzeToneDetect column1;
@PaulStoffregen
PaulStoffregen / SD_seektest.ino
Last active November 15, 2020 15:51
Arduino SD library seek from end of file test
// Test whether seek() works after reading to end of file
//
// https://twitter.com/fast_code_r_us/status/1285180217720528896
#include <SD.h>
const int csPin = 10;
void setup() {
Serial.begin(9600);
@PaulStoffregen
PaulStoffregen / dmm.c
Created February 27, 2020 23:25
Agilent 34410A for Linux
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/select.h>
#include <unistd.h>
#include <errno.h>
@PaulStoffregen
PaulStoffregen / TwitchyBun.c
Created December 4, 2019 10:04
TwitchyBun
// TwitchyBun algorithm, Dec 4 2019
// https://www.twitch.tv/ninjabunny9000
// gcc -Wall -o TwitchyBun TwitchyBun.c && ./TwitchyBun
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@PaulStoffregen
PaulStoffregen / gist:965c0676ee34bd55b2f6c23e992a0ed3
Created December 3, 2017 13:10
Quick Entropy library raw data test
// A very quick entropy test. Run on Teensy 3.x or Teensy LC.
// https://twitter.com/DavidInOregon/status/937304504210423808
volatile uint8_t val=0;
volatile bool newval=false;
void setup() {
SIM_SCGC5 |= SIM_SCGC5_LPTIMER;
LPTMR0_CSR = 0b10000100;
LPTMR0_PSR = 0b00000101; // PCS=01 : 1 kHz clock