This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 |
OlderNewer