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
#include <TimerOne.h> | |
#include <Wire.h> | |
//comment this out to see the demodulated waveform | |
//it is useful for debugging purpose. | |
#define MODULATED 1 | |
const int IR_PIN = 3; | |
const unsigned long DURATION = 180000l; | |
const int HEADER_DURATION = 2000; |
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
/* | |
BlinkTwo | |
Turns two LEDs on and off in unison. | |
The delay times are controlled by two variables | |
that are defined at the beginning of the program. | |
This example code is in the public domain. | |
*/ | |
// Use the LEDs that are connected to I/O pins 12 and 13 |
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
/* | |
BlinkTwo | |
Turns two LEDs on and off in unison. | |
The delay times are controlled by two variables that are defined at the | |
beginning of the program. | |
This example code is in the public domain. | |
*/ | |
// Use the LEDs that are connected to I/O pins 12 and 13 |
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
/* | |
BlinkArray | |
Usses and Array structure and For and If loops to create an LED chase effect | |
This example code is in the public domain. | |
*/ | |
/* Intialize an array of LED pins | |
Define a delay called "rate" |
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
/* | |
PushOnce | |
Turns on and off a light emitting diode(LED) connected to digital | |
pin 13, when pressing a pushbutton attached to pin 2. | |
The circuit: | |
* LED attached from pin 13 to ground | |
* pin 2 is attached to one leg of pushbutton and to +5V through 10k resistor | |
* other leg uf pushbutton is attached 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
void setup(){ | |
//sets pins to OUTPUT | |
pinMode(11,OUTPUT);pinMode(10,OUTPUT);pinMode(9,OUTPUT); | |
pinMode(6,OUTPUT);pinMode(5,OUTPUT);pinMode(3,OUTPUT);} | |
// extern creates global variables | |
extern float p = 1; // phase shift constant | |
extern float s = .005; // angular velocity constant | |
extern float g = 1; // brightness threshold | |
extern int mode = 0 ; // operation mode |
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
/* Shows the use of a user-defined function call from loop(). | |
The sketch also uses a flag variable to keep track of the | |
current position state of the potentiometer. | |
The potentiometer is used to provide and analog signal to pin | |
A0. When the value of the analog read variable potVal goes | |
from a value that is below 400 to a value that is above | |
the threshold value of 600 the function lights() is called to | |
flash the green and red LEDs. The function is not called again | |
until the pot is again cycle below 400 and then above 600. This |
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
// Define constants | |
const int buttonPin = 2; | |
// Define variables | |
boolean buttonState = HIGH; | |
// Setup |
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
// Define constants | |
const int buttonPin = 2; | |
// Define variables | |
boolean buttonState = HIGH; | |
// Setup |
OlderNewer