Skip to content

Instantly share code, notes, and snippets.

View Robotonics's full-sized avatar
🏠
Working from home

David Cotterill-Drew Robotonics

🏠
Working from home
View GitHub Profile
@Robotonics
Robotonics / BTtest.ino
Last active February 19, 2016 07:26
Bluetooth serial test for Arduino Bluetooth shield from Maplin
#include <SoftwareSerial.h>
#define RxD 7
#define TxD 6
SoftwareSerial BlueToothSerial(RxD,TxD);
char flag=1;
void Test_BlueTooth()
{
unsigned char t=0;
#!/usr/bin/env python2
"""
OpenCV example. Show webcam image and detect face.
"""
import cv2
TRAINSET = "/usr/share/OpenCV/lbpcascades/lbpcascade_frontalface.xml"
DOWNSCALE = 4
@Robotonics
Robotonics / Arduino Xinda IR remote
Created July 17, 2014 19:34
Arduino IRremote library usage with cheap 20 button IR remote from Xinda
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
@Robotonics
Robotonics / GUI_2
Created July 12, 2014 21:39
Arduino sketch to display temp+humidty data from DHT11 sensor on ST7735 TFT LCD
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
#include <dht.h> // dht temp humidity sensor library
#define cs 10
#define dc 9
#define rst 8
#define DHT11_PIN 3
byte highByte;
byte lowByte;
?
Wire.beginTransmission(address); //starts communication with cmps03
Wire.write(2); //Sends the register we wish to read
Wire.endTransmission();
?
Wire.requestFrom(address, 2); //requests high byte
while(Wire.available() < 2); //while there is a byte to receive
highByte = Wire.read(); //reads the byte as an integer
@Robotonics
Robotonics / sample code to test sensor
Created January 6, 2014 13:12
TCN75 Temp Sensor-Arduino
#include?"Wire.h"
#define?tcn75address?0x4F?// with pins 5~7 set to GND, the device address is 0x48
void setup()
{
??Wire.begin(); // wake up I2C bus
??Serial.begin(115200);
}
float tcn75_getTemperature(int address)
@Robotonics
Robotonics / MegaBot.cpp
Created January 4, 2014 19:18
Megabot C++ file for MegaBot library
// Megabot control library
// David Cotterill-Drew @2013 RoboTonics
#include <Arduino.h>
#include <MegaBot.h>
MegaBot::MegaBot(int R0, int R1, int L0, int L1, int EN0, int EN1)
{
int _R0=R0;
@Robotonics
Robotonics / MegaBot.h
Created January 4, 2014 19:16
Header for MegaBot library
// Arduino library to control Megabot Drive
// David Cotterill-Drew @2013 RoboTonics
#ifndef MegaBot_h
#define MegaBot_h
#include <Arduino.h>
class MegaBot
{
@Robotonics
Robotonics / JoystickView
Created December 30, 2013 13:38
Virtual Joystick- Android/Arduino via adb
package org.microbridge.servocontrol;
import java.io.IOException;
import org.microbridge.server.AbstractServerListener;
import org.microbridge.server.Server;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<!-- Totally "960 Colors"
Author : VenomVendor
Refer : http://stackoverflow.com/q/3769762/1008278
Reference : http://www.computerhope.com/htmcolor.htm , http://www.color-hex.com/color-names.html
-->
<!-- Colors arranged from A -Z -->
<color name="air_force_blue">#5D8AA8</color>