Skip to content

Instantly share code, notes, and snippets.

@HappyCodingRobot
HappyCodingRobot / Scheduler_Example.c
Last active August 22, 2019 19:32
Very basic Round Robin scheduler for AVR
#include <avr/io.h>
#include <avr/interrupt.h>
#include <inttypes.h>
#include "scheduler.h"
// Task definitions
#define nTask1 1
#define nTask2 2
@HappyCodingRobot
HappyCodingRobot / VerticalScrolledFrame.py
Created May 31, 2019 22:20 — forked from novel-yet-trivial/VerticalScrolledFrame.py
A vertical scrolled frame for python tkinter that behaves like a normal Frame. Tested with python 2 and 3, windows and linux.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
class VerticalScrolledFrame:
"""
@HappyCodingRobot
HappyCodingRobot / class_attribute_test.py
Created May 31, 2019 22:02 — forked from sente/class_attribute_test.py
Example of how to use __getattribute__(self,name) and __setattr__(self,name,val)
class Foo(object):
def __getattribute__(self, name):
print "getting attribute %s" % name
return object.__getattribute__(self, name)
def __setattr__(self, name, val):
print "setting attribute %s to %r" % (name, val)
return object.__setattr__(self, name, val)
@HappyCodingRobot
HappyCodingRobot / Makefile
Last active December 7, 2017 19:04
slightly enhanced Arduino makefile framework
# Hey Emacs, this is a -*- makefile -*-
#
# see: http://ed.am/dev/make/arduino-mk
#
# SOURCES := main.c other.cpp
# LIBRARIES := EEPROM SPI Adafruit_GFX Adafruit_ST7735
# LIBRARYPATH :=
# CPPFLAGS := -std=c++11 -Wl,-Map=foo.map -Wa,-aln=OUT.s
# SERIALMON := cutecom
#
@HappyCodingRobot
HappyCodingRobot / tmp100_i2c_read.py
Created October 29, 2015 20:42
Reading TI TMP100 sensor via i2c and libmpsse
# -*- coding: utf-8 -*-
from mpsse import *
import time
i2c = MPSSE(I2C, FOUR_HUNDRED_KHZ)
#i2c = MPSSE(I2C, ONE_HUNDRED_KHZ)
# Adress: \x4A (base) -> write: \x94 , read: \x95
# Configuration: \x60 (01100000b : 12bit resolution)
@HappyCodingRobot
HappyCodingRobot / multimeter.py
Created December 11, 2015 17:00
Reading data from Voltcraft VC506 multimeter for long-term measurements
#!/usr/bin/python
'''
Read data from Voltcraft VC506
and write to file or console
see:
https://pythonhosted.org/pyserial/
'''
import serial
import time
@HappyCodingRobot
HappyCodingRobot / LED_cie1931.py
Created June 6, 2015 16:20
Create correction table for PWM values based on CIE1931 algorithm
#!/usr/bin/python3
#
''' Script to create a correction table for PWM values
to create linear brightness for a LED
based on the CIE1931 algorithm
original author: ??
'''
PWM_BIT_SIZE = 8 # Bit size of used PWM
CORR_TABLE_SIZE = 16 # Number of elements in vector
####