Skip to content

Instantly share code, notes, and snippets.

@mitchtech
mitchtech / gist:1668640
Created January 24, 2012 07:07
ADB_Simple_Analog_Input
#include <SPI.h>
#include <Adb.h>
Connection * connection;
// Elapsed time for sensor sampling
long lastTime;
// Event handler for shell connection; called whenever data sent from Android to Microcontroller
void adbEventHandler(Connection * connection, adb_eventType event, uint16_t length, uint8_t * data)
@mitchtech
mitchtech / gist:1668646
Created January 24, 2012 07:09
ADB_Simple_Digital_Output
#include <SPI.h>
#include <Adb.h>
#define LEDcount 3
Connection * connection;
long lastTime;
//Array of state of LEDs
@mitchtech
mitchtech / gist:1686176
Created January 27, 2012 00:43
ADB_Simple_Digital_Input
#include <SPI.h>
#include <Adb.h>
#define BUTTON1 2
#define BUTTON2 3
Connection * connection;
// Bytes for each button state
byte b1, b2;
@mitchtech
mitchtech / gist:1686179
Created January 27, 2012 00:44
ADB_Simple_Analog_Output
#include <SPI.h>
#include <Adb.h>
Connection * connection;
// LED leads connected to PWM pins
const int RED_LED_PIN = 3;
const int GREEN_LED_PIN = 5;
const int BLUE_LED_PIN = 6;
@mitchtech
mitchtech / gist:1695856
Created January 28, 2012 21:46
ADB_Combination_Lock
#include <SPI.h>
#include <Adb.h>
#include <Servo.h>
#define SERVO1 5
Servo servo1;
Connection * connection;
@mitchtech
mitchtech / gist:1695858
Created January 28, 2012 21:47
ADB_D_Pad
#include <SPI.h>
#include <Adb.h>
#define BUTTON_LEFT 2
#define BUTTON_UP 3
#define BUTTON_DOWN 4
#define BUTTON_RIGHT 5
Connection * connection;
@mitchtech
mitchtech / gist:1695867
Created January 28, 2012 21:48
ADB_Pan_Tilt_LEDs
#include <SPI.h>
#include <Adb.h>
#include <Servo.h>
#define LED1 3
#define LED2 4
#define SERVO1 5
#define SERVO2 6
Servo servos[2];
@mitchtech
mitchtech / gist:1701096
Created January 29, 2012 22:35
ADB_Andy_Android
#include <SPI.h>
#include <Adb.h>
#include <Servo.h>
#define LED1 3
#define LED2 4
#define SERVO1 5
Servo servo1;
@mitchtech
mitchtech / gist:1701101
Created January 29, 2012 22:36
ADB_Dual_Analog_Input
#include <SPI.h>
#include <Adb.h>
Connection * connection;
// Elapsed time for sensor sampling
long lastTime;
// Event handler for shell connection; called whenever data sent from Android to Microcontroller
void adbEventHandler(Connection * connection, adb_eventType event, uint16_t length, uint8_t * data)
@mitchtech
mitchtech / gist:1701106
Created January 29, 2012 22:37
ADB_Serial_4_Digit_LED
#include <SPI.h>
#include <Adb.h>
#include <SoftwareSerial.h>
Connection * connection;
// Pins for TTL 4 digit serial display
#define rxPin 2
#define txPin 3