Skip to content

Instantly share code, notes, and snippets.

View tjeastman's full-sized avatar

Thomas Eastman tjeastman

View GitHub Profile
@tjeastman
tjeastman / bootloader.md
Last active February 15, 2016 05:35
Flash an ATmega328P with the Arduino bootloader using a USBTinyISP AVR programmer

On a Debian-based system, install the avrdude and arduino-core packages and then run:

$ avrdude -p atmega328p -c usbtiny -U lock:w:0x3f:m -U lfuse:w:0xff:m -U hfuse:w:0xde:m -U efuse:w:0xfd:m
$ avrdude -p atmega328p -c usbtiny -U flash:w:/usr/share/arduino/hardware/arduino/bootloaders/optiboot/optiboot_atmega328.hex -U lock:w:0x0f:m

Fuse settings are from the file /usr/share/arduino/hardware/arduino/boards.txt for the Uno:

uno.name=Arduino Uno
uno.upload.protocol=arduino
@tjeastman
tjeastman / Makefile
Created February 7, 2016 18:57
Arduino project makefile
# program file is make.ino
# depends on arduino-mk package (Debian)
# run make upload to compile and upload program to Uno device
BOARD_TAG = uno
ARDUINO_PORT = /dev/ttyACM0
include /usr/share/arduino/Arduino.mk
@tjeastman
tjeastman / read_temperatures_from_owserver.py
Last active November 5, 2017 16:22
read temperature values from a OneWire device via owserver
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# install dependencies:
# apt-get install libow-dev
# pip install onewire influxdb
import argparse
from datetime import datetime
import logging
@tjeastman
tjeastman / parse_sensors.py
Last active June 23, 2019 08:03
parse "sensors -u" output with Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
class Metric(object):
def __init__(self, adapter_id, sensor_id, sensor_key, value, label):
self._value = self.parse_value(value)