Skip to content

Instantly share code, notes, and snippets.

View Miceuz's full-sized avatar

Albertas Mickėnas Miceuz

View GitHub Profile
@Miceuz
Miceuz / cie1931.py
Created April 19, 2016 15:05
cie color correction table
INPUT_SIZE = 255 # Input integer size
OUTPUT_SIZE = 255 # Output integer size
INT_TYPE = 'const unsigned char'
TABLE_NAME = 'cie';
def cie1931(L):
L = L*100.0
if L <= 8:
return (L/902.3)
else:
@Miceuz
Miceuz / avrdude.conf
Last active January 4, 2018 16:00
avrdude.conf patch for AtTiny441
#------------------------------------------------------------
# ATTiny441
#------------------------------------------------------------
part
id = "t441";
desc = "ATtiny441";
has_debugwire = yes;
flash_instr = 0xB4, 0x07, 0x17;
#define STEP_X 49
#define DIR_X 51
#define ENA_X 53
#define STEP_Y 43
#define DIR_Y 45
#define ENA_Y 47
void setup() {
pinMode(STEP_X, OUTPUT);
/*
Fades a line down the channels, with max value and duration based on
the voltage of analog pin 0.
Try grounding analog 0: everything should turn off.
Try putting +5V into analog 0: everything should turn on.
See the BasicUse example for hardware setup.
Alex Leone <acleone ~AT~ gmail.com>, 2009-02-03 */
@Miceuz
Miceuz / vu-meter.ino
Last active November 15, 2015 15:38
VU meter based on TLC5940 led dimmer
#include "Tlc5940.h"
void setup() {
Tlc.init();
}
uint32_t level = 0;
void loop() {
@Miceuz
Miceuz / shirdis.ino
Created August 6, 2015 10:14
Kazimiero širdis
#define BPM 85//beats per minute
#define fadeinLength 20 //milliseconds
#define fadeoutLength fadeinLength * 3
#define fadeinPause fadeinLength * 1000L / 255
#!/usr/bin/python
#by Daniel Tamm
from chirp import Chirp
import sys
if len(sys.argv) < 3:
print "Usage: %s old_addr new_addr" % (sys.argv[0])
print "Standard Chirp address is 0x20 (32)."
print "Use ''i2cdetect -y 1'' to see your current Chirp addresses."
@Miceuz
Miceuz / chirp.py
Created July 24, 2015 20:11
I2C soil moisture sensor with RaspberryPi
#!/usr/bin/python
# cannot use python3 because smbus not working there
# Modified script from https://github.com/JasperWallace/chirp-graphite/blob/master/chirp.py
# by DanielTamm
import smbus, time, sys
class Chirp:
def __init__(self, bus=1, address=0x20):
self.bus_num = bus
@Miceuz
Miceuz / sensor.ino
Created July 22, 2015 18:09
Standalone I2C soil moisture sensor example
/*
I2C sensor - arduino example
Connection
Chirp pin 1 - no connection
Chirp pin 2 - Arduino VCC
Chirp pin 3 - Arduino A5
Chirp pin 4 - Arduino A4
Chirp pin 5 - no connection
Chirp pin 6 - Arduino GND
@Miceuz
Miceuz / Chirp Arduino example
Created February 9, 2015 20:01
Chirp Arduino example
/*
Chirp - arduino example
Connection
Chirp pin 1 - no connection
Chirp pin 2 - Arduino VCC
Chirp pin 3 - Arduino A5
Chirp pin 4 - Arduino A4
Chirp pin 5 - Arduino pin 2
Chirp pin 6 - Arduino GND