hi guys
please me.
im stuck in project, trying make countdowntimer prop bomb.
i have been doing lot of trial , error code, quite messy, sorry☺
i´m using 8 digits 7 segment display spreading out minutes, seconds , tenths leaving 1 digit off in between each make better.
the countdown starts @ "4 59 00" after 10 seconds delay. stops @ "01 02 10"
everything looks fine, can me make stop at "00 02 10" instead?
thank you☺
and code:
please me.
im stuck in project, trying make countdowntimer prop bomb.
i have been doing lot of trial , error code, quite messy, sorry☺
i´m using 8 digits 7 segment display spreading out minutes, seconds , tenths leaving 1 digit off in between each make better.
the countdown starts @ "4 59 00" after 10 seconds delay. stops @ "01 02 10"
everything looks fine, can me make stop at "00 02 10" instead?
thank you☺
and code:
code: [select]
#include <ledcontrol.h> //we cant without importing suitable library!
// lets start pinouts max72xx led driver
// *****************************************************
int din = 7; // pin 1 on max72xx
int clk = 6; // pin 13 on max72xx
int loadcs = 5; // pin 12 on max72xx
int flashdelay = 100; // delay in ms (100=1/10th second)
int ledbrightness = 15; // range 0-15. 0=lowest, 15 = full power
// define ledcontrol instance - if want more can setup lc2, lc3 etc
// ************************************************************************
ledcontrol lc=ledcontrol(din,clk,loadcs,1); // din, clk, load/cs, 1 = 1 chip max chip attached.
void setup()
{
pinmode(din, output); // once only, lets make pins outputs
pinmode(clk, output);
pinmode(loadcs, output);
// take pins out of power save mode. no updates otherwise.
for(int index=0;index<lc.getdevicecount();index++) {
lc.shutdown(index,false);
}
lc.setintensity(0,ledbrightness ); //set brightness
delay(10000); // delay
int row = 0; //set starting position
int chipid = 0; //this not strictly reqd, if using more 1 display needed
// first lets display hours
// ****************************
(int hourcountdown=001; hourcountdown>000; hourcountdown--){
int x=hourcountdown;
int hourones;
int hourtens;
hourones=x%10;
hourtens=x/10%10; // %10 divides ten , extracts remainder
lc.setchar(chipid, row+8, 'h', false); // adds letter h
lc.setdigit(chipid, row+9, (byte) hourones, false); // these 2 lines add numerical hours
lc.setdigit(chipid, row+9, (byte) hourtens, false); // technique repeated several times!
// minutes
(int minutecountdown=04; minutecountdown >00; minutecountdown--){
int y=minutecountdown;
int minuteones;
int minutetens;
minuteones=y%10;
minutetens=y/10%10; // %10 divides ten , extracts remainder
lc.setdigit(chipid, row+6, minuteones, true); // these 2 lines add numerical hours
lc.setdigit(chipid, row+7, minutetens, false); // deja vu?
// , seconds/tenths make exciting!
(int seccountdown=600; seccountdown>20; seccountdown--){
int v=seccountdown;
int tenths;
int secones;
int sectens;
int thousands;
tenths=v%10; // again divide 10 , calculate remainder
secones=v/10%10;
sectens=v/100%10;
thousands=v/1000%10;
lc.setdigit(chipid, row, (byte) thousands, false);
lc.setdigit(chipid, row+1, (byte) tenths, false);
lc.setdigit(chipid, row+3, (byte) secones, true); // true in arguments activates dot...
lc.setdigit(chipid, row+4, (byte) sectens, false);
delay (flashdelay);
}
}}}
void loop() // here comes stuff, main loop!
{}
if in place code in loop() function , not in setup().
Arduino Forum > Using Arduino > Programming Questions > Bomb Countdown
arduino
Comments
Post a Comment