Skip to content

Instantly share code, notes, and snippets.

@adnbr
adnbr / max7219-basic.c
Last active November 23, 2023 23:09
Simple AVR code for using a MAX7219 7-segment display driver
/* MAX7219 Interaction Code
* ---------------------------
* For more information see
* http://www.adnbr.co.uk/articles/max7219-and-7-segment-displays
*
* 668 bytes - ATmega168 - 16MHz
*/
// 16MHz clock
#define F_CPU 16000000UL
@adnbr
adnbr / counting-millis.c
Created April 21, 2012 19:01
Counting the passing of milliseconds using Timer1 on AVR.
/* Counting Milliseconds with Timer1
* ---------------------------------
* For more information see
* http://www.adnbr.co.uk/articles/counting-milliseconds
*
* 620 bytes - ATmega168 - 16MHz
*/
// 16MHz Clock
#define F_CPU 16000000UL
@adnbr
adnbr / simple-usart-commands.c
Last active September 22, 2022 07:01
Parsing simple USART commands on an AVR
/* Parsing simple USART commands
* -----------------------------
* For more information see
* http://www.adnbr.co.uk/articles/parsing-simple-usart-commands
*
* 996 bytes - ATmega168 - 16MHz
*/
#define F_CPU 16000000UL
#define BAUD 19200
@adnbr
adnbr / attiny13-adc-pwm.c
Last active March 4, 2022 00:13
ADC input directly to PWM output, on an ATtiny13.
/* ---------------------------------------------------------------------
* PWM LED Brightness control for ATtiny13.
* Datasheet for ATtiny13: http://www.atmel.com/images/doc2535.pdf
*
* Pin configuration -
* PB1/OC0B: LED output (Pin 6)
* PB2/ADC1: Potentiometer input (Pin 7)
*
* ~100 bytes.
*
{
"response_type":"in_channel",
"text":"The interior sensors are currently located in the Workshop.",
"username":"Environmental Bot",
"icon_emoji":":thermometer:",
"attachments":[
{
"color":newspace_colour,
"mrkdwn_in":[
"text",
@adnbr
adnbr / environment_bot.py
Last active April 5, 2018 12:32
Trending temperature, time print on Slack is now the time of the last Thingspeak update
# -*- coding: utf-8 -*-
# Consolidates several data feeds from Thingspeak and SpaceAPI for consumption
# in Slack, where users can find out whether they should wear shorts by using
# the '/temperature' command.
# Outside weather data is from DarkSky. You'll need to get an API key.
# This script is run on a cron job every 15 minutes writing out to a static file
# available on a web server.