Skip to content

Instantly share code, notes, and snippets.

@pingud98
pingud98 / Distancemeasurement
Created August 27, 2015 07:33
HC-SR04 ultrasonic position sensor - without any wiring
/*
A (neat) cheat way of getting the HC-SR04 distance sensor working on an Arduino Uno
put it in the end, with the GND aligned with the GND pin next to pin 13 and AREF
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
@pingud98
pingud98 / Robotboothpicture.py
Last active August 29, 2015 13:55
Robot Photobooth for Android (QR code input)
#now fixed to use the latest twitter API as of Feb 2014.
#runs fine on SL4A r6 with Python 2.6.2 and Tweepy 2 for python 2.6
import android
import tweepy
import time
droid=android.Android()
#droid.wakeLockAcquirePartial()
@pingud98
pingud98 / Talkingphotobooth.py
Created February 3, 2014 14:54
Robot Photobooth for Android- Talking part
#witty things for your android phone to say whilst it's pretending to be a photo booth.
#run as a background script to avoid any thread clashes/multitasking issues with the main photo taking script
#written for python in SL4A
import android, time, random
runcontinuous = True
droid=android.Android()
dialogues = {0 : "Hello, I'm the robot photo booth! Please show me your QR codes and I will take your picture and tweet it back to you. Please put your QR code in front of the camera now",
1: "I can't see your QR code properly, is it upside down?",
@pingud98
pingud98 / Miniarmcablibration.pde
Created February 27, 2014 23:33
Robot arm manual control for processing
import cc.arduino.*;
import processing.serial.*;
Arduino arduino;
int servo1Pin = 9; // Control pin for servo motor
int servo2Pin = 10; // Control pin for servo motor
int servo3Pin = 11; // Control pin for servo motor
int penposn;
void setup(){
@pingud98
pingud98 / gcodemake.pde
Created January 27, 2015 23:43
Mr Beam raster scan script for JPG to Gcode conversion
/**
* Convert a JPG image to gcode for Mr Beam
* To use, put the .jpg you want to use in the /data folder of your sketch and adjust the canvas size(x,y) to suit the image,
* Use the feedrate, laserfloor and lasermax variables to determine how fast and how hard it burns.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@pingud98
pingud98 / TC74readout
Created March 18, 2015 19:16
TC74 I2C temp sensor and arduino
#include <Wire.h>
//wire library
/*
Sourced from
http://www.instructables.com/id/Thermostat-Microcontroller-with-an-Arduino-and-a-T/step4/TC74-Arduino-code/
and modified a bit!
*/
//works better when you connect SDA and SCLK
@pingud98
pingud98 / Piinterruptread
Created March 26, 2015 20:36
Cosmic Pi - Port read in on interrupt
//insert gpl code headers here
//macro cycle:
//setup: intitalise, read all devices and send, wait for gps acquisition
//loop: null
//interrupt:
//1)read in ADC's (direct port sampling)
//2)read out GPS timestamp (TIMEMARK) and position (UART or SPI)
//3)read out extra data (temp, pressure, humidity) (I2C)
//3.1)maybe read some more out of the adc's (3 samples?) direct port sampling, cycle clock
//4)apply high level trigger (threshold?) test.
@pingud98
pingud98 / cosmicdatamaker
Created June 19, 2015 20:23
Cosmic Pi data generator script
/*
DigitalReadSerial
Reads a digital input on pin 2, prints the result to the serial monitor
This example code is in the public domain.
*/
// digital pin 2 has a pushbutton attached to it. Give it a name:
//int pushButton = 2;
@pingud98
pingud98 / gist:2f859cd9a8e740ceec1d
Created June 20, 2015 14:18
Cosmic Pi 10DOF IMU + Temp/Humidity combined readout
// HTU21D-F is on Arduino Due I2C Bus 2, followed the guidance on forum.arduino.cc/index.php?topic=216359.0 to make it work
//modifications to HTU21DF.h and .cpp not included in this file. Also commented out delay.h as it's AVR not ARM.
#include <Adafruit_Sensor.h>
#include <Adafruit_L3GD20_U.h>
#include <Adafruit_BMP085_U.h>
#include <Adafruit_LSM303_U.h>
#include <Adafruit_10DOF.h>
@pingud98
pingud98 / piread
Last active August 29, 2015 14:23
Cosmic Pi readout version 1
#include <Adafruit_GPS.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_L3GD20_U.h>
#include <Adafruit_BMP085_U.h>
#include <Adafruit_LSM303_U.h>
#include <Adafruit_10DOF.h>
#include <Adafruit_HTU21DF.h>
#include <Wire.h>
#define mySerial Serial1