Skip to content

Instantly share code, notes, and snippets.

@adnbr
adnbr / environment_bot.py
Last active Apr 5, 2018
Trending temperature, time print on Slack is now the time of the last Thingspeak update
View environment_bot.py
# -*- 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.
View expanded-environment-bot.json
{
"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 / attiny13-adc-pwm.c
Last active Oct 9, 2019
ADC input directly to PWM output, on an ATtiny13.
View attiny13-adc-pwm.c
/* ---------------------------------------------------------------------
* 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.
*
@adnbr
adnbr / simple-usart-commands.c
Last active Mar 15, 2020
Parsing simple USART commands on an AVR
View simple-usart-commands.c
/* 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 / counting-millis.c
Created Apr 21, 2012
Counting the passing of milliseconds using Timer1 on AVR.
View counting-millis.c
/* 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 / max7219-basic.c
Last active Jun 3, 2020
Simple AVR code for using a MAX7219 7-segment display driver
View max7219-basic.c
/* 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
You can’t perform that action at this time.