Skip to content

Instantly share code, notes, and snippets.

@Koepel
Koepel / averageRead.ino
Created January 12, 2020 22:14
This is how I use the average
// ---------------------------------------------
// averageRead.ino
// ---------------------------------------------
// License: The Unlicense, Public Domain.
// Author: Koepel
//
// Version 1, 2020 jan 12
// First version of how I use the average.
// I'm not sure if this is the final version.
// ---------------------------------------------
@Koepel
Koepel / Goldbach.ino
Created March 18, 2018 20:21
Arduino sketch for Goldbach's conjecture.
// Arduino IDE 1.8.5, Arduino Uno.
// 2018
// Warning: Just a test, it is still full of bugs.
//
// No use of tables, everything is calculated again for every number.
unsigned long number = 4; // start with 4, it must be even and greater than 2
void setup()
{
@Koepel
Koepel / Progmem_far.ino
Last active March 27, 2024 15:16
Test PROGMEM beyond 64k
// Test PROGMEM beyond 64k
//
// This test is with Arduino IDE 1.8.5 and a Arduino Mega 2560.
//
// 29 december 2017
//
// For: http://forum.arduino.cc/index.php?topic=519175
//
// 2019: See https://forum.arduino.cc/index.php?topic=622922.0
// for multiple PROGMEM segments.
@Koepel
Koepel / FreezingSketch.ino
Last active December 21, 2017 11:14
Arduino sketch to test the Arduino board with freezing temperatures.
// Freezing Sketch
// ---------------
//
// December 2017
// Initial version.
// Using Arduino IDE 1.8.5
// For an Arduino Uno, Nano, Pro Mini.
// Not fully tested, but I did test it with freezing temperatures.
//
//
@Koepel
Koepel / HighWaterMark.ino
Created December 29, 2016 13:52
Arduino sketch to find the memory that was never used (HighWaterMark of the Stack) for a AVR microcontroller.
// -----------------------------------------
// HighWaterMark of the stack
// -----------------------------------------
// Calculate the high water mark for a Arduino with AVR microcontroller.
// It is the amount of memory that was never used since the Arduino was started.
//
// The __init() or .init1 up to .init9 was used in the past.
// It was used to run assembly code to fill the unused ram with a pattern.
// With Arduino 1.8.0 that did no longer work.
//
@Koepel
Koepel / Wasted.ino
Created November 16, 2016 09:24
Arduino sketch to calculate how much time is wasted in delays.
// Wasted
// ------
// Show the percentage of cpu time that is wasted in delay().
// ----------------------------------------------------------
//
// 8 nov 2016, by Koepel.
// first version. Public Domain.
//
// 16 nov 2016, by Koepel
// Added more comment. Added fixed delay inside yield().
@Koepel
Koepel / BH1750.ino
Created August 17, 2016 16:19
BH1750 Arduino sketch to compare different modes
// BH1750.ino
// ----------
// 17 august 2016
// First version by Koepel. Public Domain.
// Tested with Arduino Uno and Arduino.cc IDE 1.6.9
// In 2016, there are about 10 to 20 libraries for the BH1750,
// but I was not happy with the existing code.
// I started from scratch and tried to get the maximum out of the sensor.
//
//