Skip to content

Instantly share code, notes, and snippets.

@vargham
vargham / attiny_pwm_main.cpp
Created July 18, 2018 07:24
Adjustable PWM for ATtiny85
/*
* Adjustable PWM for ATtiny85
* by Mark Peter Vargha
* varghamarkpeter.hu
*/
#ifndef F_CPU
#define F_CPU 8000000
#endif
@vargham
vargham / attiny_blinky_main.cpp
Created July 18, 2018 04:47
Adjustable LED blinky for ATtiny85
/*
* Adjustable LED blinky for ATtiny85
* by Mark Peter Vargha
* varghamarkpeter.hu
*/
#ifndef F_CPU
#define F_CPU 1000000
#endif
@vargham
vargham / pin_change_test.ino
Last active March 17, 2018 10:46
Arduino vs AVR Libc pin change speed
// Arduino vs AVR Libc pin change speed
// by Mark Peter Vargha
// varghamarkpeter.hu
//
// AVR pin toggle: 0.44 us
//
// Arduino Polling: 6-11 us
// Arduino Interrupt: 11.7 us
// AVR Polling: 0.4 - 0.8 us
// AVR Interrupt: 1.4 us
@vargham
vargham / simple_time_based_cooperative.ino
Last active March 17, 2018 11:17
Simple, cooperative timed tasks in Arduino
/*
* Simple, cooperative timed tasks example in Arduino
* by Mark Peter Vargha
* varghamarkpeter.hu
*/
#define INTERVAL_LED 1000
#define INTERVAL_PRINT 5000
unsigned long ledTimestamp = 0;
@vargham
vargham / pin_timed_off.ino
Last active March 17, 2018 11:18
Timed turn off GPIO
/*
* Simple, cooperative timed GPIO turn off example in Arduino
* by Mark Peter Vargha
* varghamarkpeter.hu
*/
#define BUTTON_PIN 3
#define SSR_PIN 2
#define POT_PIN A0
@vargham
vargham / lamp_auto_off.ino
Last active January 15, 2017 16:28
Auto off lamp with Arduino
/*
* Auto off lamp with manual override.
* https://circuits.io/circuits/3546758-auto-off-lamp
* Mark Peter Vargha
* varghamarkpeter.hu
*/
#define LAMP_PIN 9
#define LED_PIN 8
#define BUTTON_PIN 7