Skip to content

Instantly share code, notes, and snippets.

View ringodin's full-sized avatar

Ringotron5000 ringodin

View GitHub Profile
@ringodin
ringodin / example For Loop for ArdBot
Created October 7, 2014 00:33
This will be for students learning about for loops
int pwm_a = 3; //PWM control for motor outputs 1 and 2 is on digital pin 3
int pwm_b = 11; //PWM control for motor outputs 3 and 4 is on digital pin 11
int dir_a = 12; //direction control for motor outputs 1 and 2 is on digital pin 12
int dir_b = 13; //direction control for motor outputs 3 and 4 is on digital pin 13
int val = 0; //value for fade
void setup()
{
pinMode(pwm_a, OUTPUT); //Set control pins to be outputs
pinMode(pwm_b, OUTPUT);
@ringodin
ringodin / Basic Ardbot Code
Created October 7, 2014 02:49
This is basic code that i start my students with when using ArdBot, with a sparkfun motor shield. I got the code from Sparkfun.
/*
5/22/2012
Timothy Holmberg
SparkFun Electronics
This code includes the ddition of fade in and out PWM. Also a stop feature. And the addition of individual functions for motor control
This was a revision of the example sketch that originated from Pete Dokter's code for Arduino that shows very basically how to control an Ardumoto
motor driver shield with a 5V Arduino controller board. http://www.sparkfun.com/datasheets/DevTools/Arduino/Ardumoto_test_3.pde
@ringodin
ringodin / simple button code for LED
Created October 7, 2014 03:23
this is too teach students about button use
/*
http://www.arduino.cc/en/Tutorial/Button
*/
const int buttonPin = 7; // the number of the pushbutton pin
const int green = 13; // the number of the LED pin
void setup()
{
pinMode(green, OUTPUT);
@ringodin
ringodin / Basic Code for EL Wiro
Created November 16, 2014 07:59
This is a sample code to get students started on their EL wiring project known as EL Wiro. This is for the Maker Robotics course at International School Manila.
// Test sketch for El Escudo Dos
// Turn each EL channel (A-H) on in sequence and repeat
// Mike Grusin, SparkFun Electronics
int A = 2;
int B = 3;
int C = 4;
int D = 5;
int E = 6;
int F = 7;
const int Trig_pinRight = 12; // Triggers Pulse for RIGHT Ultrasonic Sensor
const int Echo_pinRight = 10; // Recevies Echo for RIGHT Ultrasonic Sensor
long durationRight; // Time it takes for pulse to bounce back to RIGHT Ultrasonic Sensor
void setup() {
Serial.begin(9600); // Set up Serial library at 9600 bps
Serial.println("Initializing..."); // Print Initializing... to confirm code is working with Serial Library
const int Trig_pin = 12; // Triggers Pulse for THE Ultrasonic Sensor
const int Echo_pin = 10; // Recevies Echo for THE Ultrasonic Sensor
int led = 13;
long duration; // Time it takes for pulse to bounce back to THE Ultrasonic Sensor
void setup() {
pinMode(led, OUTPUT);
const int Trig_pin = 12; // Triggers Pulse for THE Ultrasonic Sensor
const int Echo_pin = 10; // Recevies Echo for THE Ultrasonic Sensor
int led = 13;
long duration; // Time it takes for pulse to bounce back to THE Ultrasonic Sensor
void setup() {
pinMode(led, OUTPUT);
@ringodin
ringodin / simpleservo
Created August 19, 2015 21:29
This is for working with a single servo on arduino.
// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
#include <Servo.h>
Servo lefty; // create servo object to control a servo
// a maximum of eight servo objects can be created
#include <Servo.h>
Servo lefty; // create servo object to control a servo
Servo righty; // a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
int leftEye = 13;
int rightEye = 12;
@ringodin
ringodin / Piezo speaker basic
Created September 6, 2015 10:11
This is for a tiny piezo speaker connected to your arduino
/*
Multiple tones from a piezo speaker
circuit:
put a small piezo speaker on digital pin 8
and then ground it
(need not be a PWM pine)
no resistor needed
modified by Ringotron5000