Skip to content

Instantly share code, notes, and snippets.

@theapi
theapi / blink.c
Created January 19, 2014 18:34
The hello world of avr-c
@theapi
theapi / ping_new.ino
Last active January 2, 2016 04:59
2 ping sensors with ir transmitter
#include <NewPing.h>
#include <VirtualWire.h>
#define RF_TX_PIN 9 // Pin 12 is the default sender pin so change it here.
#define SONAR_NUM 2 // Number of sensors.
#define MAX_DISTANCE 500 // Maximum distance (in cm) to ping.
#define PING_INTERVAL 33 // Milliseconds between sensor pings (29ms is about the min to avoid cross-sensor echo).
@theapi
theapi / pygame_ps3.py
Created December 24, 2013 23:16
PS3 two axis reading
import pygame
from pygame.locals import *
class App:
def __init__(self):
pygame.init()
pygame.display.set_caption("Joystick Analyzer")
# Set up the joystick
@theapi
theapi / baby_steps.ino
Created December 15, 2013 20:22
baby_steps.ino backup
// https://github.com/netlabtoolkit/VarSpeedServo
#include <VarSpeedServo.h>
#define LEFT_ANKLE_CENTRE 90
//Servo servo;
VarSpeedServo LeftHip;
VarSpeedServo LeftAnkle;
@theapi
theapi / servos_serial.ino
Last active December 31, 2015 08:29
servos_serial.ino backup
// https://github.com/netlabtoolkit/VarSpeedServo
#include <VarSpeedServo.h>
#define LEFT_ANKLE_CENTRE 90
//Servo servo;
VarSpeedServo LeftHip;
VarSpeedServo LeftAnkle;
VarSpeedServo RightHip;
@theapi
theapi / motor_ir_alpha.ino
Last active December 30, 2015 04:49
tmp ir noticing (sillyness)
#define LED_LEFT_PIN 4
#define LED_RIGHT_PIN 3
#define PIR_LEFT_PIN 12
#define PIR_RIGHT_PIN 11
#define MOTOR_LEFT_PIN 6
#define MOTOR_RIGHT_PIN 5
/* DoorbellReceiver.ino - Detects signal from wireless doorbell.
Modified sketch (unknown licence) from Riva, to be found at
http://forum.arduino.cc/index.php?topic=110662.msg1094167#msg1094167
DBAD Public Licence (http://www.dbad-license.org/)
crutzen.eu - July 2013
Modified by Peter Clarke https://github.com/theapi
@theapi
theapi / doorbell.ino
Created November 25, 2013 17:04
Very hacky listen to the wireless doorbell
int i, good, k, j, incoming;
int inPin = 3;
int led = 13;
int steps = 8;
int on = 0;
byte data_in;
void setup()
@theapi
theapi / pygamesound.py
Created November 13, 2013 13:46
Play sounds with pygame without a GUI with the sounds being chosen by key presses.
import os
os.environ['SDL_VIDEODRIVER'] = 'dummy'
import pygame
import curses
# -----------------------------------------------------------------------------
class curses_screen:
def __enter__(self):
@theapi
theapi / ws_joystick.html
Last active May 31, 2022 16:02
Websocket with the virtual joystick Uses WebSocket-for-Python (CherryPy) & https://github.com/jeromeetienne/virtualjoystick.js
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<script type='application/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>
<script type='application/javascript'>
$(document).ready(function() {