Build Your Own Mini Timer

Jessica UelmenJessica Uelmen Posts: 490
edited 2013-11-07 - 14:19:41 in Learn with BlocklyProp
Build Your Own Mini Timer
·
Timers are extremely useful in everyday life.· We use them to cook, play games, and even when teachers give tests.· This activity will show you how to build your own 1-9 minute timer using only parts included in the BASIC Stamp Activity Kit.

View Video Introduction (YouTube)
Download Source Code

Getting Started

If you are new to the BASIC Stamp microcontroller or to programming, it would be a good idea to review the following before continuing:
·
······· Complete the following chapters in What’s a Microcontroller:
o······· Chapter 1 (Getting Started with the BASIC Stamp)
o······· Chapter 3, Activities 1 & 2 (Pushbutton Control)
o······· Chapter 5, Activity 1-3 (Measuring Rotation)
o······· Chapter 6 (Digital Display)
o······· Chapter 8 (Frequency and Sound)
······· Review the following commands in the BASIC Stamp Syntax and Reference Manual (page numbers from v2.2):
o········ LOOKDOWN (page 271)
o········ LOOKUP (page 277)

Parts Required

This activity can be completed solely with the parts included in the BASIC Stamp Activity Kit or the Radio Shack What's a Microcontroller BASIC Stamp Kit.· Below is a listing of all parts required for this activity:

(1)· HomeWork Board with BASIC Stamp 2
····· The BASIC Stamp 2 Board of Education is also suitable for·this activity
(1)· 7-Segment LED display
(1)· Piezospeaker
(1)· 10 k Ω potentiometer
(1)· Pushbutton
(2)· 220 Ω Resistors
(8)· 1 k Ω Resistors
(1)· 10 k Ω Resistor

Schematics and Building the Circuits

Not only does this activity provide another useful application for your WAM Kit, but it is also a great lesson on optimizing your breadboard real estate.· There are a lot of components to fit onto the board, so we need to make the most of the space available.· Figure 1 shows the schematic and Figure 2 shows the wiring diagram for this mini timer.

Figure 1 – Timer Circuit Schematic
attachment.php?attachmentid=61160

Figure 2 – Timer Circuit Wiring Diagram
attachment.php?attachmentid=61161

Testing the Circuit

Once everything is wired, it’s important to check that everything is wired correctly.· The program below will test each aspect of the circuit in one shot.· Run TestCircuit.bs2 and verify that the following occurs:

······· The piezospeaker plays a tone
······· The 7-Segment LED displays the numbers 0-9
······· The decay time of the potentiometer ranges from about 1-600
······· The pushbutton state is 1 when the button is pressed and 0 when the button is not pressed.
[color=#008000]' TestCircuit.bs2[/color]
[color=#008000]' Test each electrical component to be sure things were wired correctly.[/color]
 
[color=#008000]' {$STAMP BS2}[/color]
[color=#008000]' {$PBASIC 2.5}[/color]
 
[color=#000000]time     VAR    Word                      [/color][color=#008000]' Variable space for decay time[/color]
 
[color=#800080]OUTH[/color][color=#000000] = %00000000                          [/color][color=#008000]' Clear LED display[/color]
[color=#800080]DIRH[/color][color=#000000] = %11111111                          [/color][color=#008000]' Set pins 8-15 to outputs[/color]
 
[color=#020FC0]FREQOUT[/color][color=#000000] 7, 100, 3500                      [/color][color=#008000]' Test speaker[/color]
[color=#020FC0]PAUSE[/color][color=#000000] 100[/color]
[color=#020FC0]FREQOUT[/color][color=#000000] 7, 100, 3500[/color]
 
[color=#800080]OUTH[/color][color=#000000] = %11100111                          [/color][color=#008000]' 0[/color]
[color=#020FC0]PAUSE[/color][color=#000000] 500[/color]
[color=#800080]OUTH[/color][color=#000000] = %10000100                          [/color][color=#008000]' 1[/color]
[color=#020FC0]PAUSE[/color][color=#000000] 500[/color]
[color=#800080]OUTH[/color][color=#000000] = %11010011                          [/color][color=#008000]' 2[/color]
[color=#020FC0]PAUSE[/color][color=#000000] 500[/color]
[color=#800080]OUTH[/color][color=#000000] = %11010110                          [/color][color=#008000]' 3[/color]
[color=#020FC0]PAUSE[/color][color=#000000] 500[/color]
[color=#800080]OUTH[/color][color=#000000] = %10110100                          [/color][color=#008000]' 4[/color]
[color=#020FC0]PAUSE[/color][color=#000000] 500[/color]
[color=#800080]OUTH[/color][color=#000000] = %01110110                          [/color][color=#008000]' 5[/color]
[color=#020FC0]PAUSE[/color][color=#000000] 500[/color]
[color=#800080]OUTH[/color][color=#000000] = %01110111                          [/color][color=#008000]' 6[/color]
[color=#020FC0]PAUSE[/color][color=#000000] 500[/color]
[color=#800080]OUTH[/color][color=#000000] = %11000100                          [/color][color=#008000]' 7[/color]
[color=#020FC0]PAUSE[/color][color=#000000] 500[/color]
[color=#800080]OUTH[/color][color=#000000] = %11110111                          [/color][color=#008000]' 8[/color]
[color=#020FC0]PAUSE[/color][color=#000000] 500[/color]
[color=#800080]OUTH[/color][color=#000000] = %11110110                          [/color][color=#008000]' 9[/color]
 
[color=#020FC0]DO[/color]
  [color=#020FC0]HIGH[/color][color=#000000] 0                                  [/color][color=#008000]' Test potentiometer[/color]
  [color=#020FC0]PAUSE[/color][color=#000000] 100[/color]
  [color=#020FC0]RCTIME[/color][color=#000000] 0, 1, time[/color]
  [color=#020FC0]DEBUG[/color] [color=#800080]HOME[/color][color=#000000], [/color][color=#ff0000]"time = "[/color][color=#000000], [/color][color=#000080]DEC5[/color][color=#000000] time, [/color][color=#800080]CR[/color]    [color=#008000]' Display decay time[/color]
 
  [color=#020FC0]DEBUG[/color][color=#000000] ? [/color][color=#800080]IN3[/color]                             [color=#008000]' Display PB states[/color]
[color=#020FC0]LOOP[/color]



While running this program, one important thing to check is the range of decay times for the potentiometer, which will be used to change the display of the 7-Segment LED from 0-9. ·Using this range, we can calculate the decay time interval for each minute, ensuring that the minutes complete a full cycle with the potentiometer.· Each potentiometer can vary, so for the most accurate results it is very important that you check the range for your potentiometer.·
·
For example, say your potentiometer range was 1-594.· Since we want to display 10 total digits (0-9), we can divide 594 by 10 to get a decay time increment of 59.4.· This means we’ll want the number displayed on the 7-Segment LED to change whenever the decay time increases by 59:

attachment.php?attachmentid=73724

TestNumbers.bs2

This brings us to our next test program, TestNumbers.bs2.· Run this program and verify that the 7-Segment LED displays the numbers 0-9 as the user rotates the potentiometer.
[color=#008000]' TestNumbers.bs2[/color]
[color=#008000]' Test that the numbers increase from 1-9 when turning the pot.[/color]
 
[color=#008000]' {$STAMP BS2}[/color]
[color=#008000]' {$PBASIC 2.5}[/color]
 
[color=#000000]index    VAR    Nib[/color]
[color=#000000]time     VAR    Word[/color]
 
[color=#800080]OUTH[/color][color=#000000] = %00000000                [/color][color=#008000]' Clear LED display[/color]
[color=#800080]DIRH[/color][color=#000000] = %11111111                [/color][color=#008000]' Set pins 8-15 to outputs[/color]
 
[color=#020FC0]DO[/color]
  [color=#020FC0]HIGH[/color][color=#000000] 0[/color]
  [color=#020FC0]PAUSE[/color][color=#000000] 100[/color]
  [color=#020FC0]RCTIME[/color][color=#000000] 0, 1, time[/color]
 
  [color=#020FC0]LOOKDOWN[/color][color=#000000] time, <= [noparse][[/noparse] 1, 60, 119, 178, 237, 296, 355, 414,[/color]
[color=#000000]                     473, 532 ], index[/color]
 
  [color=#020FC0]LOOKUP[/color][color=#000000] index, [noparse][[/noparse] %11100111, %10000100, %11010011, %11010110,[/color]
[color=#000000]                  %10110100, %01110110, %01110111, %11000100,[/color]
[color=#000000]                  %11110111, %11110110 ], [/color][color=#800080]OUTH[/color]
[color=#020FC0]LOOP[/color]


This program uses the LOOKUP and LOOKDOWN commands to display digits on the 7-Segement LED.· First, the program takes an RCTIME measurement and stores it in the variable time.
·
HIGH 0
PAUSE 100
RCTIME 0, 1, time

The LOOKDOWN table then uses value stored in time to determine which number in the list time is smaller than.· It then loads that number’s entry number (which is 0-9 in this case) into the variable index.
·
LOOKDOWN time, <= [noparse][[/noparse] 1, 60, 119, 178, 237, 296, 355, 414,
·················· 473, 532 ], index
·
Lastly, the LOOKUP table uses the value in index to display the proper number on the 7-Segment LED.· The corresponding binary value is then loaded into the OUTH variable.
·
LOOKUP index, [noparse][[/noparse] %11100111, %10000100, %11010011, %11010110,
··············· %10110100, %01110110, %01110111, %11000100,
············· ··%11110111, %11110110 ], OUTH
·
MiniTimer.bs2

Once the circuit has been tested and the numbers 0-9 are displayed on the 7-Segment LED, there’s just a bit more to add to the code in order to complete the timer.

[color=#000000][color=#008000]' -----[noparse][[/noparse] Title ]----------------------------------------------------------------------[/color]
[color=#008000]' MiniTimer.bs2[/color]
[color=#008000]' Simple timer to time 1-9 minutes based on user input.[/color]
 
[color=#008000]' {$STAMP BS2}                               ' Stamp directive -> BS2[/color]
[color=#008000]' {$PBASIC 2.5}                              ' PBASIC directive -> v2.5[/color]
 
[color=#008000]' -----[noparse][[/noparse] Variables ]------------------------------------------------------------------[/color]
[/color] 
[color=#000000]index        VAR    Nib         [/color][color=#008000]' Variable space for LOOKUP/LOOKDOWN[/color]
[color=#000000]time         VAR    Word        [/color][color=#008000]' Decay time of potentiometer[/color]
[color=#000000]totalSecs    VAR    Word        [/color][color=#008000]' Total number of minutes entered by user[/color]
[color=#000000]duration     VAR    Word        [/color][color=#008000]' Variable space for FOR...NEXT loop[/color]
[color=#000000]frequency    VAR    Word        [/color][color=#008000]' Frequency[/color]
 
[color=#800080][color=#008000]' -----[noparse][[/noparse] Initialization ]-------------------------------------------------------------[/color]
[/color] 
[color=#800080]OUTH[/color][color=#000000] = %00000000                [/color][color=#008000]' Clear LED display[/color]
[color=#800080]DIRH[/color][color=#000000] = %11111111                [/color][color=#008000]' Set pins 8-15 to outputs[/color]
 
[color=#020FC0]FREQOUT[/color][color=#000000] 7, 100, 3500            [/color][color=#008000]' Program startup sound[/color]
[color=#020FC0]PAUSE[/color][color=#000000] 100[/color]
[color=#020FC0]FREQOUT[/color][color=#000000] 7, 100, 3500[/color]
 
[color=#020FC0][color=#008000]' -----[noparse][[/noparse] Main Routine ]---------------------------------------------------------------[/color]
[/color] 
[color=#000000][color=#020FC0]DO[/color]
[/color]  [color=#020FC0]HIGH[/color][color=#000000] 0                        [/color][color=#008000]' Get decay time measurements[/color]
  [color=#020FC0]PAUSE[/color][color=#000000] 100[/color]
  [color=#020FC0]RCTIME[/color][color=#000000] 0, 1, time[/color]
 
  [color=#020FC0]LOOKDOWN[/color][color=#000000] time, <= [noparse][[/noparse] 1, 60, 119, 178, 237, 296,     [/color][color=#008000]' Compare decay time to pre-[/color]
[color=#000000]                     355, 414, 473, 532], index      [/color][color=#008000]' determined timer values[/color]
 
  [color=#020FC0]LOOKUP[/color][color=#000000] index, [noparse][[/noparse] %11100111, %10000100, %11010011,   [/color][color=#008000]' Display 0-9 based on the[/color]
[color=#000000]                  %11010110, %10110100, %01110110,   [/color][color=#008000]' value in index[/color]
[color=#000000]                  %01110111, %11000100, %11110111,[/color]
[color=#000000]                  %11110110 ], [/color][color=#800080]OUTH[/color]
[color=#020FC0]LOOP[/color] [color=#020FC0]UNTIL[/color][color=#000000] ([/color][color=#800080]IN3[/color][color=#000000] = 1)                                 [/color][color=#008000]' Loop until button is pressed[/color]
 
[color=#000000]totalSecs = index * 60          [/color][color=#008000]' Calculate total number of 1-second increments[/color] [color=#008000]needed[/color]
                                [color=#008000]'[/color] [color=#008000]to match number of minutes selected by the[/color] [color=#008000]user.[/color]
 
[color=#020FC0]FREQOUT[/color][color=#000000] 7, 500, 3000            [/color][color=#008000]' Tone to note start of countdown[/color]
 
[color=#020FC0]FOR[/color][color=#000000] duration = totalSecs [/color][color=#020FC0]TO[/color][color=#000000] 0[/color]
  [color=#020FC0]PAUSE[/color][color=#000000] 990                                          [/color][color=#008000]' Wait 1 second[/color]
 
  [color=#020FC0]LOOKDOWN[/color][color=#000000] duration, <= [noparse][[/noparse]  0,  60, 120, 180,         [/color][color=#008000]' Compare value in duration[/color] [color=#008000]to[/color]
[color=#000000]                         240, 300, 360, 420,         [/color][color=#008000]' number of seconds[/color]
[color=#000000]                         480, 540], index[/color]
 
  [color=#020FC0]LOOKUP[/color][color=#000000] index, [noparse][[/noparse] %11100111, %10000100, %11010011,   [/color][color=#008000]' Display 0-9 based on the[/color]
[color=#000000]                  %11010110, %10110100, %01110110,   [/color][color=#008000]' value in index[/color]
[color=#000000]                  %01110111, %11000100, %11110111,[/color]
[color=#000000]                  %11110110 ], [/color][color=#800080]OUTH[/color]
[color=#020FC0]NEXT[/color]
 
[color=#020FC0]FOR[/color][color=#000000] duration = 15 [/color][color=#020FC0]TO[/color][color=#000000] 1                               [/color][color=#008000]' Play "times up" tone[/color]
  [color=#020FC0]FOR[/color][color=#000000] frequency = 3000 [/color][color=#020FC0]TO[/color][color=#000000] 3500 [/color][color=#020FC0]STEP[/color][color=#000000] 20[/color]
    [color=#020FC0]FREQOUT[/color][color=#000000] 7, duration, frequency[/color]
  [color=#020FC0]NEXT[/color]
  [color=#020FC0]FOR[/color][color=#000000] frequency = 2000 [/color][color=#020FC0]TO[/color][color=#000000] 2500 [/color][color=#020FC0]STEP[/color][color=#000000] 10[/color]
    [color=#020FC0]FREQOUT[/color][color=#000000] 7, duration, frequency[/color]
  [color=#020FC0]NEXT[/color]
[color=#020FC0]NEXT
[/color] 



The first part of the program completes the same tasks as TestNumbers.bs2.· However, instead of displaying the numbers indefinitely, the program waits for the user to press the button and then starts the timer.· Before executing the timer loop, we need to convert the number of minutes for the timer to seconds.· This allows us to use a FOR…NEXT loop and a PAUSE command to easily count down each minute.·
·
You may also notice that the program only pauses for 990 ms instead of the expected 1000 ms.· This is because when comparing the results of this timer with a stopwatch, it was found that the LOOKUP and LOOKDOWN statements take about 10 ms to execute.· So really the approximate pause time of the FOR…NEXT loop is 1000 ms.
·
Finally, additional LOOKUP and LOOKDOWN commands show the user how many minutes are left on the timer by comparing the value in the variable duration to a table of second values.
·
totalSecs = index * 60
·
FOR duration = totalSecs TO 0
· PAUSE 990
·
· LOOKDOWN duration, <= [noparse][[/noparse]· 0,· 60, 120, 180,
················· ·······240, 300, 360, 420,
························ 480, 540], index
·
· LOOKUP index, [noparse][[/noparse] %11100111, %10000100, %11010011,
················· %11010110, %10110100, %01110110,
················· %01110111, %11000100, %11110111,
················· %11110110 ], OUTH
NEXT
·
To finish, the piezospeaker emits a unique series of tones to let the user know the timer is up.· These tones can be customized to whatever you would like, so get creative!· If you need inspiration, check out Chapter 8 in What’s a Microcontroller.
·
FOR duration = 15 TO 1
· FOR frequency = 3000 TO 3500 STEP 20
··· FREQOUT 7, duration, frequency
· NEXT
· FOR frequency = 2000 TO 2500 STEP 10
··· FREQOUT 7, duration, frequency
· NEXT
NEXT
__________________________________________________ ___________________________
··
(c) 2009·by Parallax Inc - all rights reserved.··

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jessica Uelmen
Education Department
Parallax Inc.

Post Edited (Jessica Uelmen (Parallax)) : 8/25/2010 6:30:50 PM GMT
Allons-y!
--
@jessicauelmen
505 x 503 - 35K
380 x 469 - 31K
747 x 66 - 6K

Comments

  • mikedivmikediv Posts: 825
    edited 2009-05-29 - 00:53:47
    Jessica I built this project and have gotten everything to work with the exception of the 7 segment display.
    My Led will only light up if I connect the The common anodes which in your drawing shows them tied to ground, to positive.
    But then while it will now light up and change numbers when I move the POT up or down does not show the correct values , I know the 7 segment display works because I have a test circuit with a
    PIC and it works properly am I missing something?
    Thanks
  • Jessica UelmenJessica Uelmen Posts: 490
    edited 2009-05-29 - 17:04:18
    Hi mikediv,

    Do you have a problem with the TestCircuit.bs2 program, or just when trying TestNumbers.bs2? The 7-Segment LED definitely needs to be grounded since each segment of the LED will light up depending if its pin is high or low.

    One thing to make sure of is that the middle pin of bottom of the LED is connected to ground and the top middle pin of the LED is not connected to anything. If that is the case, then check that none of the resistor leads are touching or sharing a connection with another part of your circuit. (See page 173 of What's a Microcontroller for a better picture - I'll also add this to the article.)

    As another test, you can try the programs in Chapter 6, Activities 2 & 3 of What's a Microcontroller and see if your LED works when running these. If that works, you can leave that connection there and then add the rest of the components.

    If you would like, you can attach a picture of your wiring and I can take a look and see if I can see any problems.

    Jessica

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jessica Uelmen
    Education Department
    Parallax, Inc.

    Post Edited (Jessica Uelmen (Parallax)) : 5/29/2009 5:09:36 PM GMT
    Allons-y!
    --
    @jessicauelmen
  • Dave-WDave-W Posts: 94
    edited 2009-05-29 - 17:28:29
    Hello Mike,
    I think you have a Common Anode display.
    This project uses a Common Cathode display but the Common Anode will work if you reverse the bits. Mak a Zero a One and a One a Zero.

    11100111 = 00011000

    Hope this works

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave W.
  • KARIM102KARIM102 Posts: 75
    edited 2009-08-25 - 00:47:48
    thx a lot it was so nice!!!!!!!!!!!
  • jmerrelljmerrell Posts: 25
    edited 2013-11-05 - 15:07:00
    I have built the mini timer and everything works except when I run the decay program. Nothing shows up in the debug screen except zeros. Also, numbers do not show up on the 7-segment led as I turn the pot. Need help please. Thanks
  • Steph LindsaySteph Lindsay Posts: 759
    edited 2013-11-06 - 09:10:41
    Hi jmerrell,

    First, can I ask if you are using the 7 segment LED that came with the BASIC Stamp Activity Kit? That one has a common cathode, and so is wired up as shown in the diagram. If instead you are using a different 7-segment LED with a common anode, you would run into problems as did KARIM102 in the posts above. Dave-W posted a solution for that.

    Check that out and let us know if the type of 7-segment LED is the issue or not.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-11-06 - 11:40:15
    Check your wiring from the Propeller input to the pot. If a wire is not right, you get all zeros.
    Hwang Xian Shen, Puddleby-on-the-Marsh.
    All things considered, I can live and thrive without Microsoft products. LINUX is just fine.
  • jmerrelljmerrell Posts: 25
    edited 2013-11-07 - 07:24:21
    Hi jmerrell,

    First, can I ask if you are using the 7 segment LED that came with the BASIC Stamp Activity Kit? That one has a common cathode, and so is wired up as shown in the diagram. If instead you are using a different 7-segment LED with a common anode, you would run into problems as did KARIM102 in the posts above. Dave-W posted a solution for that.

    Check that out and let us know if the type of 7-segment LED is the issue or not.

    Steph, I was able to run activities 2 and 3 in chapter 6 successfully. I still dont get the results I should from runing the MiniTimerDecay.bs2 program. The led numbers do not show when I turn the pot. I am sure the RC circuit is correct. Here is a photo of my circuit. By the way, I have omitted the buzzer part, yet the wiring is still there for it. The pot came with the kit.
    MiniTimer.jpg
    1024 x 768 - 74K
  • Steph LindsaySteph Lindsay Posts: 759
    edited 2013-11-07 - 08:47:26
    Thanks for posting the picture! Looking at the circuit, it looks like the pushbutton leg that should connect to Vdd, missed the breadboard row and is in the trench in between instead. Did you run TestCircuit.bs2 and TestNumbers.bs2, or only MiniTimer.bs2? It stays in a loop until the button is pressed, so I could see that creating a problem.

    If TestCircuit.bs2 is not showing any change in decay time on the Debug Terminal, then it's the potentiometer circuit. Some tips:
    • These pots sometimes pop up out of the board. Try pressing it down to make sure it is seated. You can also try gently straightening the legs and giving them a very, very careful 1/4 turn twist to help them stay seated in the breadboard better.
    • Look for a leg folded under the pot, or broken off.
    • Check the ground connections - it looks like there is exposed copper at the end of one of your ground wires, the one connected to the pot.
    • Did you trim the leads on any of the components? It is possible to trim them just a tiny bit too short to work (ask me how I know...)
    • You can move the pot signal to a different I/O pin and update the code to match.
    • Double-check the resistor values used in the pot circuit - I cannot see the stripes from the angle in the picture.


    By the way, this activity was recently posted to the Projects section of our Learn site, where it is slightly easier to read. http://learn.parallax.com/project/build-your-own-mini-timer
  • jmerrelljmerrell Posts: 25
    edited 2013-11-07 - 10:40:23
    Thanks for posting the picture! Looking at the circuit, it looks like the pushbutton leg that should connect to Vdd, missed the breadboard row and is in the trench in between instead. Did you run TestCircuit.bs2 and TestNumbers.bs2, or only MiniTimer.bs2? It stays in a loop until the button is pressed, so I could see that creating a problem.

    If TestCircuit.bs2 is not showing any change in decay time on the Debug Terminal, then it's the potentiometer circuit. Some tips:
    • These pots sometimes pop up out of the board. Try pressing it down to make sure it is seated. You can also try gently straightening the legs and giving them a very, very careful 1/4 turn twist to help them stay seated in the breadboard better.
    • Look for a leg folded under the pot, or broken off.
    • Check the ground connections - it looks like there is exposed copper at the end of one of your ground wires, the one connected to the pot.
    • Did you trim the leads on any of the components? It is possible to trim them just a tiny bit too short to work (ask me how I know...)
    • You can move the pot signal to a different I/O pin and update the code to match.
    • Double-check the resistor values used in the pot circuit - I cannot see the stripes from the angle in the picture.
    By the way, this activity was recently posted to the Projects section of our Learn site, where it is slightly easier to read. http://learn.parallax.com/project/build-your-own-mini-timer

    Steph, I moved the RC circuit to another location and it worked. I guess it was a bad pin due to inserting the pot. I would like to have the led start at 9 and count down in 1 second intervals. Can you instruct me how to do that please? Thanks for your suggestions!
  • PublisonPublison Posts: 10,880
    edited 2013-11-07 - 11:20:13
    jmerrell wrote: »
    Steph, I was able to run activities 2 and 3 in chapter 6 successfully. I still dont get the results I should from runing the MiniTimerDecay.bs2 program. The led numbers do not show when I turn the pot. I am sure the RC circuit is correct. Here is a photo of my circuit. By the way, I have omitted the buzzer part, yet the wiring is still there for it. The pot came with the kit.
    MiniTimer.jpg

    I believe your 10K resistor is on the wrong side of the pot. It needs to go on the top connection of the switch., (per your picture).

    Mini Timer.JPG


    Edit: I meant to say it was on the wrong side of the switch.
    451 x 210 - 12K
    Infernal Machine
  • Steph LindsaySteph Lindsay Posts: 759
    edited 2013-11-07 - 13:23:20
    Glad you got it working, jmerrell!

    If all you need is to have the displaycount down from 9 to 0 in one second intervals, without using the pot or pushbutton, take a look at DisplayDigits.bs2 on page 179 in What's a Microcontroller? version 3.0 (a free PDF download).

    That one counts from 0 to 9, with a PAUSE 1000 in between each number. You could just re-arrange the lines of code to make it count from 9 to 0 instead.
  • jmerrelljmerrell Posts: 25
    edited 2013-11-07 - 14:19:41
    Perfect!!! Thanks for all your Steph. You did a great job in helping me out. :-)
  • How can i change my values so it counts down in seconds not minutes?
Sign In or Register to comment.