Skip to content

Instantly share code, notes, and snippets.

@ronnietucker
ronnietucker / Ultrasonic & Servo
Last active August 29, 2015 14:12
Controlling a servo (with ultrasonic sensor) via joystick
#include <UTFT.h>
#include <NewPing.h>
#include <Servo.h>
#define TRIGGER_PIN 5 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 3 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
Servo myservo; // create servo L/R object
Servo myservo2; // create servo U/D object
@ronnietucker
ronnietucker / Soil Moisture Detection
Last active August 29, 2015 14:14
Soil Moisture Detection
/*
CREDITS:
DS3231 library: https://github.com/rodan/ds3231
RTC+LCD code: https://www.youtube.com/watch?v=NDwSrgfsiYQ
DHT11 code: http://playground.arduino.cc/main/DHT11Lib
WiFi to Thingspeak: http://www.instructables.com/id/ESP8266-Wifi-Temperature-Logger/step3/Arduino-Setup-and-Sketch/
*/
//Celsius to Fahrenheit conversion
double Fahrenheit(double celsius)
@ronnietucker
ronnietucker / 2WD Robot
Last active August 29, 2015 14:16
2WD Dagu Magician Robot
// Bluetooth module is an HC-06
// default pw = 1234
// Vcc=5v, Gnd=0, Rx > Tx1, Tx > Rx1
// Flashing red LED on BT module = not connected
// Using ArduinoRC for control.
// AduinoRC is currently set for WSAD to control Fwd, Bk, L and R
#include <AFMotor.h>
#include <NewPing.h>
@ronnietucker
ronnietucker / UltrasonicTFT
Created May 6, 2015 19:44
Ultrasonic + TFT screen
#include <UTFT.h>
#include <NewPing.h>
#define TRIGGER_PIN 5 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 3 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
//for QD_TFT180X SPI LCD Modle
@ronnietucker
ronnietucker / Brewduino
Last active December 27, 2015 13:22
Brewduino will monitor a fermentation vessel for temperature, and for controlling a heat mat.
// LCD i2c (Four Pin LCD sreen)
// use pins 20 and 21 on MEGA
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
// get new LCD library from: https://bitbucket.org/fmalpartida/new-liquidcrystal
// DHT22
#include <dht.h>
dht DHT;
@ronnietucker
ronnietucker / RFID Reader
Last active April 3, 2017 03:22
RFID Reader
// code from:
// http://www.grantgibson.co.uk/2012/04/how-to-get-started-with-the-mifare-mf522-an-and-arduino/
// 3.3v > 3.3v
// RST > Pin 5
// GND > Ground
// IRQ > not used
// MISO > Pin 12
// MOSI > Pin 11
// SCK > Pin 13
@ronnietucker
ronnietucker / Moisture Detection
Last active May 13, 2018 20:58
Moisture Detection With Two Nails
int moistureSensor = 0; // nail to read from is pin A0
int moisture_val;
const int redLEDPin = 3; // red LED connected to digital pin
const int yellowLEDPin = 4; // yellow LED connected to digital pin
const int greenLEDPin = 5; // green LED connected to digital pin
const int blueLEDPin = 7; // blue LED connected to digital pin
const int buttonPin = 9; // button connected to digital pin
const int voltage = 8; // the voltage nail is on pin D8
@ronnietucker
ronnietucker / Auto Chicken Feeder
Last active December 11, 2018 18:48
Automatic Chicken Feeder
/*
CREDITS:
DS3231 library: https://github.com/rodan/ds3231 - see examples for alarm stuff
RTC+LCD code: https://www.youtube.com/watch?v=NDwSrgfsiYQ
DHT11 code: http://playground.arduino.cc/main/DHT11Lib
WiFi to Thingspeak: http://www.instructables.com/id/ESP8266-Wifi-Temperature-Logger/step3/Arduino-Setup-and-Sketch/
*/
//Celsius to Fahrenheit conversion
double Fahrenheit(double celsius)