Skip to content

Instantly share code, notes, and snippets.

#define dir_pin 13
#define step_pin 12
#define en_pin 17
#define TIMER1_ON TIMSK1 |= (1 << OCIE1A);
#define TIMER1_OFF TIMSK1 &= ~(1 << OCIE1A);
int OCR_INIT = 10000;
int OCR_VAL = OCR_INIT;
@fullnitrous
fullnitrous / timer.ino
Created April 21, 2021 22:27
CPU Cycle Timing code
volatile unsigned long overflows = 0;
void setup()
{
Serial.begin(115200);
TIMSK1 = _BV(TOIE1);
TCCR0A = 0;
TCCR0B = 0;
}
@fullnitrous
fullnitrous / rgb_to_hsl.c
Last active October 20, 2018 22:43
Proper conversion of RGB to HSL
/*
RGB to HSL
Compile with: gcc rgb_to_hsl.c -lm -o rgb_to_hsl
*/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <stdint.h>
@fullnitrous
fullnitrous / hsl_to_rgb.c
Created October 20, 2018 19:25
Proper Conversion of HSL color to RGB
/*
HSL to RGB
Compile with: gcc hsl_to_rgb.c -lm -o hsl_to_rgb
Attributions to: cburn11, https://forum.level1techs.com/u/cburn11
*/
#include <stdlib.h>
#include <stdio.h>