-
Notifications
You must be signed in to change notification settings - Fork 0
Home
- Countdown to the end of the Mayan calendar and celebrate
- Countdown to when the polar ice caps melt, prepare for that boating trip
- Or any other doomsday of your choice
- Countdown the days until Christmas
- Countdown the days until your visa or green card expires (this is what I'm using for)
- Countdown the hours until your favorite store closes.
- Count down the time until your ebay auction closes.
- Counting the days as they prepare for marriage
- Anticipating to graduate
- Expecting a baby
- Counting the days until they get out of prison
- Counting the days from their last cigarette
- Setting exercise goals for losing weight
- Ham radio operators who need to report their ID every hour
TIME IS RUNNING OUT! hehe
Play pranks on your friends. With 7-segment there are so many great things you can do. Make a prop bom for your You-tube move about Mr.Evil. Build a fake cryocooler with styrofoam and tin foil. Put the Doomsday clock on it as a High tech temperature display. Put it in your living room. Tell your friends that you have cryogenically frozen your deceased grand mother for until the day she can be brought back to life.
www.CountDownClock.tumblr.com
If you have a something on the internet about the Doomsday Clock I would love to know about it, and I can add your link here.
www.instructables.com/id/Good-ChoiceBad-Choice-Machine
"Made this for my daughters. It tracks their good and bad choices, to help motivate them to do good." by Killer Turtle
At this point not all of the example code has been completed
This documentation is intended to be adequate to help somebody at a near beginner level
All of our hardware and documentation is a work in progress. We strongly appreciate your suggestions and support!
The short link for this website is www.SamuraiCircuits.com/wiki/Doomsday
<htmlet>Flickr</htmlet>/7264/7017047731_a3da88ba57_n<htmlet>Back</htmlet>
Prepare for the end of the world and learn about programming seven segment LEDs by Charlieplexing all at the same time.
Did you ever notice that the bad guys in Hollywood almost never use LCDs.
That’s because there’s nothing cooler than seven segment. With this kit you can build your very own countdown clock. Inform yourself daily of the countdown to the end of the world, or at least the end of time in the Mayan calendar (Dec. 21, 2012). This shield may also make a great gift for that friend who is counting the days until they graduate, retire, or baby is born.
Need we say more!
Useful for displaying the date or the time Year-Month-Day (yy-mm-dd) or Hour-Minutes-Seconds (hh-mm-ss)
With the beeper you can add a chirp to every second that passes increasing the sense of urgency of your countdown. Or you can use it as an alarm at the end of your countdown.
There are 12 LEDs across the top that can be used for indicating a variety of things. For instance as a visual indicator like a speedometer or level indicator. Or you can label the LEDs and have them eliminate represent different modes or functions.
The kit comes with a photo resistor. You can use it as an experimental input and display the analog output of the LED display. Or If you are trying to design the perfect alarm clock, you can use the photo resistor to detect the amount of ambient light and have your alarm clock display at full brightness during the daytime and appropriately dim the display at night.
The Arduino is able to count clock cycles and keep track of time. However if it is unplugged it will lose time. This is not a problem for less critical count downs at shorter times.
However if you want to keep track of time over a longer period you may consider using a real time clock chipset with battery backup. There are lots of them available, many of them are I2C compatible and are easily connected through this port. Another potential option for a timekeeping device is a global positioning system (GPS). GPS Received very accurate time information from satellites. This way there will be no need to set your clock as long as you have access to satellite signals.
The I2C socket can also be used for communicating with other Arduinos.
The rotary encoder is an optional add-on. It can be potentially used for setting the time or for the length of your countdown.
I personally like rotary encoders better than potentiometers. Rotary encoders can be turned a limitless number of times. Whereas potentiometers it’s often less than a full revolution. This particular rotary encoder also has a built-in button. So you can turn it or push it.
Board size: 100 x 52 mm
Hole pattern: 90 x 40 mm
<htmlet>Flickr</htmlet>/7105/7227563608_7230fa4b23_b<htmlet>Back</htmlet>
Amazon
ASIN: B00BICYC12
And Sometimes on E-bay
<htmlet>Flickr</htmlet>/8488/8154444254_70d9d9c3f0_z<htmlet>Back</htmlet>
1 x Doomsday Clock PCB 1 x 40 Pin Header 2 x Resistor Arrays 6 x 7-Segment LEDs 16 x Square Red LEDs 1 x 4 Pin Socket 1 x 4 right angle header 1 x Photo Resistor 1 x 10k Resistor 1 x Beeper
Doomsday Clock Arduino Shield Assembly Instructions are now available in PDF form.
PDF Assembly-Instructions (12.1 MB file size)
I have broken down the assembly process into seven sections. Follow these links to my highly detailed instructions.<br><font size="4" face="arial" ><b> [[ Doomsday Clock Shield Header Pins |1. Header Pins ]] [[ Doomsday Clock Shield Resistor Arrays |2. Resistor Arrays ]] [[ Doomsday Clock Shield 7-Segment LEDs |3. 7-Segment LEDs ]] [[ Doomsday Clock Shield Digital Clock Colon LEDs |4. Digital Clock Colon LEDs ]] [[ Doomsday Clock Shield Indicator LEDs |5. Indicator LEDs ]] [[ Doomsday Clock Shield Final Preparation Before Programming |6. Final Preparation Before Programming ]] [[ Doomsday Clock Shield Adding The Bells And Whistles |7. Adding The Bells And Whistles ]]
First down lode the library at this link.
This is the Doomsday Clock Arduino Library
This is the Doomsday Clock Arduino Library
Next un-zip it and place it in your Arduino Library folder. Close and re-start your Arduino environment. At the top left open the menu named "File" Go to "Examples" then follow that menu down to "Doomsday". In the "Doomsday" menu first open "Hello".
<htmlet>Flickr</htmlet>/8393/8679005800_960a8e9172_z<htmlet>Back</htmlet>
// Doomsday clock example - Hello
// Copyright (c) 2012 Devon Sean McCullough and Tully Gehan
//
// This example is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; either version 2.1
// of the License, or (at your option) any later version.
//
// See file LICENSE.txt for further informations on licensing terms.
include <Doomsday.h> //Include the Doomsday header file.
Doomsday doom; // This is the doom object
int buzzPin1 = A1; // This is the pin for the Buzzer
void setup ()
{
// set the dwell time to 72 ms. The dwell time in the amount of time it will display the "doom.printd" message
doom.begin (72); // 72 ms ~~ 14 Hz
pinMode (buzzPin1, OUTPUT);
}
void loop ()
{
// Here I have defined two values for me dwell time.
const int delayTimeFast = 70; // At 14 Hz, 70 impressions Is approximately 5 seconds
const long delayTimeSlow = 1500; // If you want the dwell time to be much more then a 1000 milliseconds or 1 second you need it to be assigned as a long.
int dots = 0; // this is the variable used to write to the indicator LEDs above the 7-segment displays.
doom.begin (delayTimeSlow); // set dwell time
//This is my approximation of "hello world" in this case it is just hello
doom.printd ("HELLO");
/*
*/
//Naturally all the numbers can be displayed
doom.printd ("123456");
/*
*/
//All the alphabet are represented is some form or another.
//There was some creative license taken. 7-segment was not made to display letters. Oh well. :)
doom.printd ("890AbC");
/*
*/
doom.printd ("cdEFGg");
/*
*/
doom.printd ("HhIiJK");
/*
*/
doom.printd ("LMnOoP");
/*
*/
doom.printd ("QqrStU");
/*
*/
doom.printd ("uvWXyZ");
/*
*/
//You can use colons to turn on the "digital clock colons"
doom.printd ("HE:LL:O");
/*
*/
//You can put periods after the letters and numbers to light up the decimal LEDs
doom.printd ("H.E.:L.L.:O. ."); // If there is nothing in the cell, you must use spaces between dots
/*
*/
// must use space between dots if you do not have any letters or numbers
// you can also light up the "digital clock colons" individually by using a comma or a apostrophe
doom.printd (" . ., . .' . .");
/*
*/
// if you bracket some of the letters or number with %( and %) that bracketed part will be dimmer.
// here :L and : are bracketed to be dimmer.
doom.printd ("HE%(:L%)L%(:%)O");
/*
*/
// if you bracket some of the letters or number with %[ and %] that bracketed part will start
// flashing on and off, assuming that your dwell time longer then one second or you call the
// "doom.printd" statement with with the flashing brackets in it repeatedly
// here the E:L are bracketed to start flashing.
// we also set the dwell time to 1.5 seconds
doom.begin (1500);
doom.printd ("H%[E:L%]L:O");
// The blinking function will work exactly the same in this for loop. Blinking at the same slow rate.
doom.begin (15);
for (int j=0; j <= 100; j++){
doom.printd ("H%[E:L%]L:O");
}
// return dwell time
doom.begin (delayTimeSlow); // set dwell time to slow
/*
*/
// non ASCII charactors' escape sequences
// _not_ = \005
// _pi_ = \007 aka \a
// _gamma_ = \011 aka \t
// _lhs_ = \020
// _rhs_ = \021
// _uhs_ = \022
// _dhs_ = \023
// _aquant_ = \024
// _equant_ = \025
// _degree_ = \033
// _eqv_ = \036
// _int_ = \177 aka \d
// You will just have to look at your display to see what they are
doom.printd ("\005\007\011\020\021\022");
/*
*/
// You will just have to look at your display to see what they are
doom.printd ("\023\024\025\033\036\177");
/*
*/
/*
*/
long value = 314159;
doom.setDecimal(value); // Next we feed the numbers in to the "setDecimal" function. It is stored as "%i".
doom.printd ("%i"); // In the print function "doom.printd" the number from "setDecimal" value is represented as "%i".
doom.begin (delayTimeFast);
for (int j=0; j <= 70; j++){
value = j*(1000000/72); // Here we make some crazy numbers
doom.setDecimal(value);
doom.printd ("%i");
}
/*
*/
// You can do animations with the indicator LEDs across the top
// In this example we set the LEDs with two bytes of data
// dots = (256 * B00000000) + B00000000;
// "dots" is the variable that where we store the two bytes of data
// The "B" at the begging of the number defines it as binary
// In binary a byte of data is 8 digest long.
// We multiply the first byte by 256 and add the second byte to it.
// This makes the two byte number. The 0's represent LEDs that
// are off and the 1's are for LEDs that are on.
// There are only 12 indicator LEDs on the top, So we only
// can change the 1s and 0s on the byte to the right and
// half of the byte on the left.
// the "dots" variable is fed in to the doom.print function on the end
// after the comma in "doom.printd ("HELLO ",dots);"
// Below is an animation. Each frame will be shown for one dwell time.
// the "for" loop will play the animation 5 times.
doom.begin (delayTimeFast);
for (int i=0; i <= 5; i++){
dots = (256 * B00000000) + B00000000;
doom.printd ("%(HE%)L%[LO%]",dots);
dots = (256 * B00000000) + B00000001; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000000) + B00000010; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000000) + B00000100; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000000) + B00001000; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000000) + B00010000; doom.printd ("%(HE'%)LL,O ",dots);
dots = (256 * B00000000) + B00100000; doom.printd ("%(HE'%)LL,O ",dots);
dots = (256 * B00000000) + B01000000; doom.printd ("%(HE'%)LL,O ",dots);
dots = (256 * B00000000) + B10000000; doom.printd ("%(HE'%)LL,O ",dots);
dots = (256 * B00000001) + B00000000; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000010) + B00000000; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000100) + B00000000; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00001000) + B00000000; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000100) + B00000000; doom.printd ("%(HE'%)LL,O ",dots);
dots = (256 * B00000010) + B00000000; doom.printd ("%(HE'%)LL,O ",dots);
dots = (256 * B00000001) + B00000000; doom.printd ("%(HE'%)LL,O ",dots);
dots = (256 * B00000000) + B10000000; doom.printd ("%(HE'%)LL,O ",dots);
dots = (256 * B00000000) + B01000000; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000000) + B00100000; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000000) + B00010000; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000000) + B00001000; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000000) + B00000100; doom.printd ("%(HE'%)LL,O ",dots);
dots = (256 * B00000000) + B00000010; doom.printd ("%(HE'%)LL,O ",dots);
dots = (256 * B00000101) + B01010101; doom.printd ("%(HE'%)LL,O ",dots);
dots = (256 * B00000000) + B00000000; doom.printd ("%(HE'%)LL,O ",dots);
dots = (256 * B00000101) + B01010101; doom.printd ("%(HE'%)LL,O ",dots);
}
for (int i=0; i <= 5; i++){
dots = (256 * B00000000) + B00100000; doom.printd ("HE,LLO ",dots);
dots = (256 * B00000000) + B01110000; doom.printd ("HE,LLO ",dots);
dots = (256 * B00000000) + B11111000; doom.printd ("HE,LLO ",dots);
dots = (256 * B00000001) + B11111100; doom.printd ("HELL,O ",dots);
dots = (256 * B00000011) + B11111110; doom.printd ("HELL,O ",dots);
dots = (256 * B00000111) + B11111111; doom.printd ("HELL,O ",dots);
dots = (256 * B00000011) + B11111110; doom.printd ("HELL'O ",dots);
dots = (256 * B00000001) + B11111100; doom.printd ("HELL'O ",dots);
dots = (256 * B00000000) + B11111000; doom.printd ("HELL'O ",dots);
dots = (256 * B00000000) + B01110000; doom.printd ("HE'LLO ",dots);
dots = (256 * B00000000) + B00100000; doom.printd ("HE'LLO ",dots);
dots = (256 * B00000000) + B00000000; doom.printd ("HE'LLO ",dots);
}
// you can also play with the dwell time
for(int i=90; i > 0; i=i*.95)
{
doom.begin (i);
dots = (256 * B00000000) + B00000001; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000000) + B00000010; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000000) + B00000100; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000000) + B00001000; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000000) + B00010000; doom.printd ("%(HE'LL,O%)",dots);
dots = (256 * B00000000) + B00100000; doom.printd ("%(HE'LL,O%)",dots);
dots = (256 * B00000000) + B01000000; doom.printd ("%(HE'LL,O%)",dots);
dots = (256 * B00000000) + B10000000; doom.printd ("%(HE'LL,O%)",dots);
dots = (256 * B00000001) + B00000000; doom.printd ("%(HE'LL,O%)",dots);
dots = (256 * B00000010) + B00000000; doom.printd ("%(HE'LL,O%)",dots);
dots = (256 * B00000100) + B00000000; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00001000) + B00000000; doom.printd ("HE,LL'O ",dots);
dots = (256 * B00000000) + B00000000; doom.printd ("HE,LL'O ",dots);
// this will make it beep at 800 Hz for 10 milliseconds
//tone(256 * BuzzPin1, 800, 10); // the most recent library crashes with this function.
}
// Extra obnoxious strobing here.
for (int i=0; i <= 50; i++){
doom.begin (20);
dots = (256 * B00000000) + B00000000; doom.printd (" ",dots);
dots = (256 * B00001111) + B11111111; doom.printd ("HE:LL:O ",dots);
//tone(256 * BuzzPin1, 800, 10);
}
}
This old code, maybe useful for somebody
The iDoom web app works great in Chrome, Explorer, Firefox, Opera and Safari.
Program your Doomsday Clock with a super cool user interface thanks to Devon Sean McCullough.
First download the library at this link. This is the iDoom Library
Next un-zip it and place it in your Arduino Library folder. Close and re-start your Arduino environment. At the top left open the menu named "File" Go to "Examples" then follow that menu down to "iDoom". In the "iDoom" menu first open "Hello".
Next you can go to: www.SamuraiCircuits.com/wiki/Doomsday/iDoom
Click on the segments that you want to illuminate. You can add frames by clicking on the little arrows pointing to the right. you can remove frames by clicking on the little arrows pointing to the left. you can start and stop the sequence by clicking on the big red triangle pointing down. when you arrive at the frame you want to edit, stop the animation by clicking on the big red triangle. and start editing the segments with your mouse. When you have finished, do a Ctrl-a, Ctrl-c (Clover-A, Clover-C on Mac) to select and copy the sketch. Then paste it into your Arduino window. It's just that cool!
http://www.samuraicircuits.com/wiki/Doomsday/Sequence01.gif
This is the Bounce Library
This is the Turn Library
Just like all other Arduino libraries you will need to unzip these files and place them in the Arduino "Libraries" folder. Make sure you load the "Turn" library and the "Bounce" library. You need to install both of them.
After that you should close and restart your Arduino programming environment. Then go to Examples >> Turn >> Bare.
<htmlet>Flickr</htmlet>/8537/8678953616_ea5e94733e_c<htmlet>Back</htmlet>
It will open a demo sketch. Load this sketch on your Arduino. Once it has installed, opened the "Serial Monitor" window. Now start to rotate the Rotary encoder knob. You will see some wonderful whimsical display of the serial output.
<htmlet>Flickr</htmlet>/8545/8678952620_bc87b0f08c_z<htmlet>Back</htmlet>
You may be wondering why the values are measured in quarters. It's because the "Ka-chunk" sound of the Rotary encoder happens for every four points of resolution. To see this for yourself you can wiggle the knob ever so slightly and watch the value increment our decrement by 0.25. If you rotate the knob until it makes the "Ka-chunk" sound that output value will have typically moved about one whole value.
Someday I hope to modify the sketch so that it will zero out when you first open the sketch and all the "Ka-chunks" will increment perfectly with whole number outputs. The file is not there yet. So for now you can use it the way it is.
Cut and paste this in your Arduino programming environment window and give it a try
// Buzzer example function for the CEM-1203 buzzer (Sparkfun's part #COM-07950).
// by Rob Faludi
// http://www.faludi.com
const int targetPin1 = A1;
const int targetPin2 = A5; // This pin is not connected in the default setup of the Doomsday Clock so I set it for "A5" which does not exist on the smaller Arduinos
void setup() {
pinMode(targetPin1, OUTPUT); // set a pin for buzzer output
pinMode(targetPin2, OUTPUT); // set a pin for buzzer output
}
void loop() {
//Stressful beeping bomb countdown
// This one I did myself -Tully
buzz(1000, 100);
delay(900); // wait a bit between buzzes
buzz(1000, 100);
delay(900); // wait a bit between buzzes
buzz(1000, 100);
delay(900); // wait a bit between buzzes
buzz(1000, 100);
delay(900); // wait a bit between buzzes
buzz(1000, 100);
delay(900); // wait a bit between buzzes
buzz(1005, 2500);
delay(900); // wait a bit between buzzes
// Super Mario Brothers
// I got it from http://arduino.cc/forum/index.php/topic,8409.0.html
// It was submitted by ReCreate
buzz(660,100);
delay(75);buzz(660,100);
delay(150);buzz(660,100);
delay(150);buzz(510,100);
delay(50);buzz(660,100);
delay(150);buzz(770,100);
delay(275);buzz(380,100);
delay(287);buzz(510,100);
delay(225);buzz(380,100);
delay(200);buzz(320,100);
delay(250);buzz(440,100);
delay(150);buzz(480,80);
delay(165);buzz(450,100);
delay(75);buzz(430,100);
delay(150);buzz(380,100);
delay(100);buzz(660,80);
delay(100);buzz(760,50);
delay(75);buzz(860,100);
delay(150);buzz(700,80);
delay(75);buzz(760,50);
delay(175);buzz(660,80);
delay(150);buzz(520,80);
delay(75);buzz(580,80);
delay(75);buzz(480,80);
delay(175);buzz(510,100);
delay(275);buzz(380,100);
delay(200);buzz(320,100);
delay(250);buzz(440,100);
delay(150);buzz(480,80);
delay(165);buzz(450,100);
delay(75);buzz(430,100);
delay(150);buzz(380,100);
delay(100);buzz(660,80);
delay(100);buzz(760,50);
delay(75);buzz(860,100);
delay(150);buzz(700,80);
delay(75);buzz(760,50);
delay(175);buzz(660,80);
delay(150);buzz(520,80);
delay(75);buzz(580,80);
delay(75);buzz(480,80);
delay(250);buzz(500,100);
delay(150);buzz(760,100);
delay(50);buzz(720,100);
delay(75);buzz(680,100);
delay(75);buzz(620,150);
delay(150);buzz(650,150);
delay(150);buzz(380,100);
delay(75);buzz(430,100);
delay(75);buzz(500,100);
delay(150);buzz(430,100);
delay(75);buzz(500,100);
delay(50);buzz(570,100);
delay(110);buzz(500,100);
delay(150);buzz(760,100);
delay(50);buzz(720,100);
delay(75);buzz(680,100);
delay(75);buzz(620,150);
delay(150);buzz(650,200);
delay(150);buzz(1020,80);
delay(150);buzz(1020,80);
delay(75);buzz(1020,80);
delay(150);buzz(380,100);
delay(150);buzz(500,100);
delay(150);buzz(760,100);
delay(50);buzz(720,100);
delay(75);buzz(680,100);
delay(75);buzz(620,150);
delay(150);buzz(650,150);
delay(150);buzz(380,100);
delay(75);buzz(430,100);
delay(75);buzz(500,100);
delay(150);buzz(430,100);
delay(75);buzz(500,100);
delay(50);buzz(570,100);
delay(110);buzz(500,100);
delay(150);buzz(760,100);
delay(50);buzz(720,100);
delay(75);buzz(680,100);
delay(75);buzz(620,150);
delay(150);buzz(650,200);
delay(150);buzz(1020,80);
delay(150);buzz(1020,80);
delay(75);buzz(1020,80);
delay(150);buzz(380,100);
delay(150);buzz(500,100);
delay(150);buzz(760,100);
delay(50);buzz(720,100);
delay(75);buzz(680,100);
delay(75);buzz(620,150);
delay(150);buzz(650,150);
delay(150);buzz(380,100);
delay(75);buzz(430,100);
delay(75);buzz(500,100);
delay(150);buzz(430,100);
delay(75);buzz(500,100);
delay(50);buzz(570,100);
delay(210);buzz(585,100);
delay(275);buzz(550,100);
delay(210);buzz(500,100);
delay(180);buzz(380,100);
delay(150);buzz(500,100);
delay(150);buzz(500,100);
delay(75);buzz(500,100);
delay(150);buzz(500,60);
delay(75);buzz(500,80);
delay(150);buzz(500,60);
delay(175);buzz(500,80);
delay(75);buzz(580,80);
delay(175);buzz(660,80);
delay(75);buzz(500,80);
delay(150);buzz(430,80);
delay(75);buzz(380,80);
delay(300);buzz(500,60);
delay(75);buzz(500,80);
delay(150);buzz(500,60);
delay(175);buzz(500,80);
delay(75);buzz(580,80);
delay(75);buzz(660,80);
delay(225);buzz(870,80);
delay(162);buzz(760,80);
delay(300);buzz(500,60);
delay(75);buzz(500,80);
delay(150);buzz(500,60);
delay(175);buzz(500,80);
delay(75);buzz(580,80);
delay(175);buzz(660,80);
delay(75);buzz(500,80);
delay(150);buzz(430,80);
delay(75);buzz(380,80);
delay(300);buzz(660,100);
delay(75);buzz(660,100);
delay(150);buzz(660,100);
delay(150);buzz(510,100);
delay(50);buzz(660,100);
delay(150);buzz(770,100);
delay(225);buzz(380,100);
}
//void buzz(int targetPin1, int targetPin2, long frequency, long length) {
void buzz( long frequency, long length) {
long delayValue = 1000000/frequency/2; // calculate the delay value between transitions
//// 1 second's worth of microseconds, divided by the frequency, then split in half since
//// there are two phases to each cycle
long numCycles = frequency * length/ 1000; // calculate the number of cycles for proper timing
//// multiply frequency, which is really cycles per second, by the number of seconds to
//// get the total number of cycles to produce
for (long i=0; i < numCycles; i++){ // for the calculated length of time...
digitalWrite(targetPin1,HIGH); // write the buzzer pin high to push out the diaphram
digitalWrite(targetPin2,LOW); // write the buzzer pin high to push out the diaphram
delayMicroseconds(delayValue); // wait for the calculated delay value
digitalWrite(targetPin1,LOW); // write the buzzer pin low to pull back the diaphram
digitalWrite(targetPin2,HIGH); // write the buzzer pin low to pull back the diaphram
delayMicroseconds(delayValue); // wait againf or the calculated delay value
}
}
At Ladyada.net there is a fantastic tutorial on the TMP36 temperature sensor. To make things more convenient I have configured the Doomsday Clock Shield temperature sensor to have the same pin-out as the demonstration on ladyada.net. So you should be able to use the code on the website without any modifications.
TMP36 Pin-out Pin1 = 3V3 Pin2 = A0 PIn3 = GND
http://www.ladyada.net/learn/sensors/tmp36.html
Current revision is: v0.2
<htmlet>Flickr</htmlet>/8330/8146351529_239e3deef8<htmlet>Back</htmlet>
V0.2 Schematic in PDF
v0.1
Both the temperature sensor and photo resistor are connected to the 5 volt supply. In the future they will be connected to the 3v3 volt supply. The 3v3 should be slightly more stable and more accurate to read at the high-end.
TEP36 => TMP36
v0.2
Short Link: www.samuraicircuits.com/wiki/Doomsday