Skip to content

Instantly share code, notes, and snippets.

@edgar-bonet
edgar-bonet / homodyne.ino
Created March 1, 2016 12:00
Homodyne detection of a 1 kHz signal
/*
* homodyne.ino: Homodyne detection of a 1 kHz signal.
*
* This program continuously samples analog input 0 and uses an homodyne
* detection scheme to identify a signal at 1 kHz (+/- 24 Hz @ -3dB).
*
* The analog-to-digital converter is set to "free running mode" and
* takes one sample every 104 us. The samples are multiplied by two
* generated signals at 1 kHz (the "local oscillator"), in quadrature to
* one another. The products are then low-pass filtered with a time
@ridencww
ridencww / SerialPrintf.txt
Last active June 12, 2023 19:12
Basic printf functionality for the Arduino serial ports
/*
* Simple printf for writing to an Arduino serial port. Allows specifying Serial..Serial3.
*
* const HardwareSerial&, the serial port to use (Serial..Serial3)
* const char* fmt, the formatting string followed by the data to be formatted
*
* int d = 65;
* float f = 123.4567;
* char* str = "Hello";
* serial_printf(Serial, "<fmt>", d);