Skip to content

Instantly share code, notes, and snippets.

View spinorkit's full-sized avatar

Kit Adams spinorkit

  • Dunedin, New Zealand
View GitHub Profile
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <deque>
#include <future>
#include <iostream>
#include <mutex>
#include <thread>
#include <vector>
@nonsintetic
nonsintetic / ArduinoZeroTimer.ino
Last active April 1, 2024 11:52
SAMD21 Arduino Timer Example
/*
* This sketch illustrates how to set a timer on an SAMD21 based board in Arduino (Feather M0, Arduino Zero should work)
* It should generate a 1Hz square wave as it is (thanks richdrich for the suggestion)
* Some more info about Timer Counter works can be found in this article:
* http://www.lucadavidian.com/2017/08/08/arduino-m0-pro-il-sistema-di-clock/
* and in the datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/SAM_D21_DA1_Family_DataSheet_DS40001882F.pdf
*/
uint32_t sampleRate = 1000; //sample rate in milliseconds, determines how often TC5_Handler is called
@je4d
je4d / gist:4341994
Created December 20, 2012 00:22
Demo of isolates with preemptible execution in v8 js
#include <chrono>
#include <memory>
#include <string>
#include <atomic>
#include <thread>
#include <iostream>
#include <v8.h>
int main()
{