Skip to content

Instantly share code, notes, and snippets.

// hint: see how this person changed the code for their robot: http://www.techbitar.com/fast-line-following-robot.html
#include <QTRSensors.h>
#include <YD_MotorDriver1.h>
#define NUM_SENSORS 6 // number of sensors used
#define TIMEOUT 2500
#define EMITTER_PIN QTR_NO_EMITTER_PIN // or 2 if you want to use this feature
#define Motor1A 8
// download library from: https://github.com/pololu/qtr-sensors-arduino
#include <QTRSensors.h>
#define NUM_SENSORS 6 // number of sensors used
#define TIMEOUT 2500
#define EMITTER_PIN QTR_NO_EMITTER_PIN // digital pin 2 is often used, but not necessary
// sensor connected through analog pins A0 - A5 i.e. digital pins 14-19
// note: the next two lines are really one line of code – it may be word-wrapped in your browser
QTRSensorsRC qtrrc((unsigned char[]) {14, 15, 16, 17, 18, 19}, NUM_SENSORS, TIMEOUT, EMITTER_PIN);
// Hook up a buzzer and use it to indicate when your robot is backing up
// source: http://forum.arduino.cc/index.php?topic=3757.0
#define BZZR 4 //digital pin to hook buzzer's red wire to
void setup() {
pinMode(BZZR, OUTPUT); //set the buzzer as output
}
void loop() {
@GreenMoonArt
GreenMoonArt / Collision Avoidance - without State Machine Library
Last active August 7, 2016 21:01
updated to remove the need to use the state machine library
// kindly provided by: http://arduino-info.wikispaces.com/RobotKitMenu-8
// There is a conflict with the State Machine library and versions of Arduino > 1.6.5
// This code eliminates the State Machine library.
/* YourDuino Basic Robot Kit V2 Collision-avoidance Test
(Rewritten using "Switch" statements to create the State Machine )
This version is slow, waits to look around.
KIT here: http://yourduino.com/sunshop2/index.php?l=product_detail&p=400
HOW-TO here: http://arduino-info.wikispaces.com/RobotKitMenu
- WHAT IT DOES:
@GreenMoonArt
GreenMoonArt / Modify The HC-05 Bluetooth Module Defaults
Last active September 15, 2016 00:10
Modify The HC-05 Bluetooth Module Defaults
// thanks to http://www.instructables.com/id/Modify-The-HC-05-Bluetooth-Module-Defaults-Using-A/
// wiring diagram: https://cdn.instructables.com/FM8/W4A2/HKZAVRT9/FM8W4A2HKZAVRT9.LARGE.jpg
/*
AUTHOR: Hazim Bitar (techbitar)
DATE: Aug 29, 2013
LICENSE: Public domain (use at your own risk)
CONTACT: techbitar at gmail dot com (techbitar.com)
Procedure to ensure AT Command Mode (identified by slow-blinking LED on HC-05) has been entered:
0. Unplug power from HC-05
@GreenMoonArt
GreenMoonArt / 8x8 LED matrix moving eyes and mouth
Last active October 15, 2016 14:52
RoboFace - modified from Adafruit_LED_Backpack Example
// Edited by @GreenMoonArt for TechShop DC's Halloween 2016
/*
Project based on:
https://learn.adafruit.com/animating-multiple-led-backpacks/ideas?view=all
Libraries and IDE board support:
Adafruit_LED_Backpack
https://github.com/adafruit/Adafruit_LED_Backpack
@GreenMoonArt
GreenMoonArt / LCD5110_Temperature_Graph
Created November 10, 2016 17:27
Display a real time temperature graph using the Nokia LCD5110 monochrome display
// to convert thermistor readings to degrees F, see:
// http://playground.arduino.cc/ComponentLib/Thermistor2
// #include <math.h> // for thermistor temp conversion math
// get display library at http://rinkydinkelectronics.com/library.php?id=47
#include <LCD5110_Graph.h>
LCD5110 myScreen(8,9,10,11,12); // create an instance of the display object
extern uint8_t SmallFont[];
// continuously move a servo while an RGB LED continuously updates its color
#include <Servo.h>
Servo servo;
const int servoRestPosition = 0; //Starting position
const int servo90Position = 90; //90 degrees
const int servoTargetPosition = 180; //Position when event is detected
// move servo in between RGB LED updates
#include <Servo.h>
Servo servo;
const int servoRestPosition = 0; //Starting position
const int servo90Position = 90; //90 degrees
const int servoTargetPosition = 180; //Position when event is detected
// Move a servo; update an RGB LED; no concurrency
// see project at:
// https://www.maker.io/en/projects/rotating-holiday-ornament-with-rgb-leds-and-a-servo-motor/3ff0a5ca80ea4e09860f6b2bb543ee0a
// Sparkfun Tinker Kit: https://www.digikey.com/product-detail/en/sparkfun-electronics/KIT-13930/KIT-13930-ND/6098607
#include <Servo.h>
Servo servo;
const int servoRestPosition = 0; //Starting position