Skip to content

Instantly share code, notes, and snippets.

@electronut
electronut / ldr.py
Created May 4, 2014 06:14
Display analog data from Arduino using Python (matplotlib animation)
"""
ldr.py
Display analog data from Arduino using Python (matplotlib)
Author: Mahesh Venkitachalam
Website: electronut.in
"""
import sys, serial, argparse
@electronut
electronut / analog-plot.ino
Created May 24, 2013 07:45
Read analog values from A0 and A1 and print them to serial port.
// analog-plot
//
// Read analog values from A0 and A1 and print them to serial port.
//
// electronut.in
#include "Arduino.h"
void setup()
{
@electronut
electronut / conway.py
Last active June 20, 2023 17:48
A simple Python matplotlib implementation of Conway's Game of Life.
################################################################################
# conway.py
#
# Author: electronut.in
#
# Description:
#
# A simple Python/matplotlib implementation of Conway's Game of Life.
################################################################################
@electronut
electronut / Makefile
Created June 1, 2013 02:57
A simple program for the ATtiny84 that blinks an LED. Use Makefile with avr-gcc/avrdude.
# Name: Makefile
#
# A simple program for the ATtiny84 that blinks an LED.
#
# electronut.in
DEVICE = attiny84
CLOCK = 8000000
PROGRAMMER = -c usbtiny
OBJECTS = main.o
@electronut
electronut / atmega168-power-save.c
Last active October 25, 2022 18:53
Putting the ATmega168 into Power Save mode, and then waking it with a pin-change interrupt.
//**********************************************************************
//
// Putting the ATmega168 into Power Save mode, and then waking it
// with a pin-change interrupt.
//
// electronut.in
//**********************************************************************
/*
build commands on OS X with CrossPack:
@electronut
electronut / Makefile
Created April 30, 2014 15:03
Makefile for programming the ATtiny85
# Makefile for programming the ATtiny85
# modified the one generated by CrossPack
DEVICE = attiny85
CLOCK = 8000000
PROGRAMMER = -c usbtiny
OBJECTS = main.o
# for ATTiny85
# see http://www.engbedded.com/fusecalc/
FUSES = -U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
@electronut
electronut / koch.py
Last active December 2, 2020 16:34
A program that explores the Koch snowflake and the Thule-Morse sequence.
"""
koch.py
Description:
A program that explores the Koch snowflake and the Thue-Morse sequence.
Author: Mahesh Venkitachalam
Website: electronut.in
"""
@electronut
electronut / Bluey Beacon Main loop.c
Last active July 28, 2020 10:03
Bluey Beacon Main loop
int main(void)
{
uint32_t err_code;
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
ble_stack_init();
advertising_init();
timers_init();
advertising_start();
@electronut
electronut / bluey-beacon-3.py
Created July 9, 2017 06:11
bluey-beacon - parse sensor data
# constant
pow_16 = 65536.0
# decode temperature
def decodeT(temp_val):
return ((temp_val / pow_16) * 165 - 40)
# decode humidity
def decodeH(humid_val):
return ((humid_val / pow_16) * 100)
@electronut
electronut / ledctrl.py
Created March 22, 2014 11:17
A simple example for communicating with a Raspberry Pi from you phone's browser. Uses the Bottle Python web framework, and jQuery AJAX.
"""
ledctrl.py
A simple example for communicating with a Raspberry Pi from you phone's
browser. Uses the Bottle Python web framework, and jQuery AJAX.
Author: Mahesh Venkitachalam / electronut.in
"""