This file contains hidden or 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
/* | |
Debounce | |
Each time the input pin goes from LOW to HIGH (e.g. because of a push-button | |
press), the output pin is toggled from LOW to HIGH or HIGH to LOW. There's | |
a minimum delay between toggles to debounce the circuit (i.e. to ignore | |
noise). | |
The circuit: | |
* LED attached from pin 13 to ground |
This file contains hidden or 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
/* Example code for a four transistor, four diode | |
H-Bridge | |
*/ | |
// Assign four H-Bridge inputs to PWM pins | |
int r1 = 6; | |
int r2 = 9; | |
int r3 = 10; | |
int r4 = 11; |
This file contains hidden or 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
/* This example employs Timer1 to blink one of three LEDs. The timer is called | |
within a For Loop which repeatedly calls a function that alternately flashes the | |
other two LEDs. The timer is "turned on" runs for a specified portion of the For Loop | |
and is then "turned off". | |
*/ | |
#include <TimerOne.h> | |
const int blinkLed = 3; // the pin with a LED that should blink | |
const int buttonLed1 = 4; // led controlled by button |
This file contains hidden or 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
/* This example employs Timer1 to blink one of three LEDs. The timer is initialized and called | |
during the setup() function which repeatedly calls a function that alternately flashes the | |
other two LEDs. The timer function continues without interruption when the loop operates. | |
*/ | |
#include <TimerOne.h> | |
// This example uses the timer interrupt to blink an LED | |
// This allows the main program to do "other stuff" |
This file contains hidden or 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
/* | |
* Having used the sketch IRrecvDemo from the IRremote library to | |
* determine the codes for four buttons on a remote, this code will | |
* now "listen" for these codes and control LEDs based upon what code | |
* has been received. | |
*/ | |
#include <IRremote.h> |
This file contains hidden or 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 ledPins[]={2,3,4,5,6,7}; | |
void setup() { | |
for(int i=0; i < 6; i=i+1){ | |
pinMode(ledPins[i],OUTPUT); | |
} | |
} |
This file contains hidden or 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 ledPins[]={2,3,4,5,6,7}; | |
int vol = 0; | |
void setup() { | |
for(int i=0; i < 6; i=i+1){ | |
pinMode(ledPins[i],OUTPUT); | |
digitalWrite(ledPins[i],LOW); | |
} | |
Serial.begin(9600); |
This file contains hidden or 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
// The UML shield has 6 LEDs which can be used to display 6 bits of data | |
// The highest binary number that can be represented is 111111 which is the | |
// integer value 63. | |
int binValue[] = {0,0,0,0,0,0}; | |
int ledArray[] = {2,3,4,5,6,7}; | |
int val = 0; | |
void setup() { | |
Serial.begin(9600); |
This file contains hidden or 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
/* | |
* UML shield | |
* Test code for array of LED's connected to digital I/O pins | |
* 2, 3, 4, 5, and 6 | |
* | |
* Board configuration: Jumper JP3 closed | |
*/ | |
// Create a six element integer array for the pin numbers |
This file contains hidden or 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 d = 5; | |
int count = 0; | |
void setup() { | |
Serial.begin(9600); | |
Serial.println(count); | |
// coil 1 | |
pinMode(11,OUTPUT); // enable pin for coil 1 |