Skip to content

Instantly share code, notes, and snippets.

View MichMich's full-sized avatar

Michael Teeuw MichMich

  • Xonay Media
  • Baarn ~ The Netherlands
View GitHub Profile
@MichMich
MichMich / attiny10_ws2812.ino
Last active November 5, 2023 16:48
AtTiny10 WS2812 Test
#include <avr/io.h>
#include <util/delay.h>
#include <stdint.h>
#include <avr/interrupt.h>
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
#define delay(ms) _delay_ms(ms)
#define PIN 2
@MichMich
MichMich / helloworld.js
Last active September 27, 2017 16:18
Templating Example
Module.register("helloworld",{
/* ... */
getTemplate: function () {
// Should return a String: the template filename.
// We could also allow users to return a template string,
// and check if the string ends with `.html` in that case
// use the file, otherwiste the literal string.
@MichMich
MichMich / main.cpp
Last active May 26, 2020 22:15
MAX7219 Counter Demo
#include <Arduino.h>
#include <LedControl.h>
#define SPINNER_SPEED 5
#define SPINNER_LENGTH 2
LedControl lc=LedControl(3, 4, 5, 1);
long num = 0;
void showNumber(long number, byte pos = 0) {
@MichMich
MichMich / main.cpp
Created January 27, 2017 08:11
Arcade Neopixel Button
#include <Arduino.h>
#include <FastLED.h>
#define LED_PIN 7
#define BUTTON_PIN 8
CRGB leds[1];
void setup() {
FastLED.addLeds<NEOPIXEL, LED_PIN>(leds, 1);
@MichMich
MichMich / main.cpp
Created December 29, 2016 18:52
QuizButtons
#include <Arduino.h>
#include <Keyboard.h>
#define BUTTON_A 3
#define BUTTON_B 4
#define BUTTON_C 5
#define BUTTON_D 6
void setup() {
pinMode(BUTTON_A, INPUT_PULLUP);
@MichMich
MichMich / Amazon S3 Client Side Upload
Created November 2, 2016 13:00
Example of an Amazon S3 upload.
<!DOCTYPE html>
<html>
<head>
<title>AWS S3 File Upload</title>
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1.12.min.js"></script>
</head>
<body>
<input type="file" id="file-chooser" />
"repositories": [
{
"type": "vcs",
"url": "https://github.com/MichMich/YoutubeDownloader"
}
],
"require": {
"masih/youtubedownloader": "*"
}
@MichMich
MichMich / gist:1a6ca57561af9f2be20d
Created June 15, 2014 21:42
initializing a property
class TestView: UIView {
let gestureRecognizer : UITapGestureRecognizer
init(frame: CGRect) {
gestureRecognizer = UITapGestureRecognizer(target: self, action: "tap") //This does not work, It doesn't know self.
super.init(frame: frame)
}
@MichMich
MichMich / StereoVU
Last active April 20, 2018 02:15
A small example for using the Sparkfun Spectrum Shield together with two Adafruit Neopixel Strips.
#include <Adafruit_NeoPixel.h>
#define PIN_NEOPIXELS 7
#define PIN_STROBE 4
#define PIN_RESET 5
#define PIN_LEFT 0 //analog
#define PIN_RIGHT 1 //analog
#define NUMLEDSPERSEGMENT 8
#define NUMLEDS NUMLEDSPERSEGMENT * 2
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor];
//The following line creates a shimmer timing problem.
FBShimmeringView *shimmerView = [[FBShimmeringView alloc]init];
//The following line works, but is unneccecery for common autolayout practices.