Is There a Cleaner Way
Archiver
Posts: 46,084
Below is a snipet of the code I want a beep at every 100th of the
countdown. I can do it the way I have it but it seems like there
would be a easier way.I thought of using a table also but that also
seems like that would involve to much space anybody have a hint.
Thanks , Stan
FOR reps = 1500 TO 1
AUXIO
dwn = reps/100
IF reps = 1400 THEN pulsout 15,60000
IF reps = 1300 THEN pulsout 15,60000
LCDOUT (LCDpin // 16), Line0, [noparse][[/noparse]" Counting Down...."]
LCDOUT (LCDpin // 16), Line1, [noparse][[/noparse]" Time Left"," " ,DEC3 dwn]
MAINIO
countdown. I can do it the way I have it but it seems like there
would be a easier way.I thought of using a table also but that also
seems like that would involve to much space anybody have a hint.
Thanks , Stan
FOR reps = 1500 TO 1
AUXIO
dwn = reps/100
IF reps = 1400 THEN pulsout 15,60000
IF reps = 1300 THEN pulsout 15,60000
LCDOUT (LCDpin // 16), Line0, [noparse][[/noparse]" Counting Down...."]
LCDOUT (LCDpin // 16), Line1, [noparse][[/noparse]" Time Left"," " ,DEC3 dwn]
MAINIO
Comments
Resp=1400
Reps=1300
Reps=1200
...
Reps=100
If so, then yes. Try this:
If reps//100 = 0 then pulsout 15,60000
You might want to stop it from ticking at 1500 so:
If reps<>1500 and reps//100=0 then ...
However, keep in mind that while that pulsout occurs you will get a 60000
unit pause in your program! So the count down won't be very smooth.
Regards,
Al Williams
AWC
* 8 channels of PWM...
http://www.awce.com/pak5.htm
Original Message
From: kingtweeter [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=NRBT4LvZN58rLaNOo6FGho61CO4uf3N28brAH1zTSlWIpNAW2O-Tbg1sU7gXjTQzm7fXSI3NqQwAIjg]jamachine@c...[/url
Sent: Wednesday, May 05, 2004 7:05 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Is There a Cleaner Way
Below is a snipet of the code I want a beep at every 100th of the
countdown. I can do it the way I have it but it seems like there
would be a easier way.I thought of using a table also but that also
seems like that would involve to much space anybody have a hint.
Thanks , Stan
FOR reps = 1500 TO 1
AUXIO
dwn = reps/100
IF reps = 1400 THEN pulsout 15,60000
IF reps = 1300 THEN pulsout 15,60000
LCDOUT (LCDpin // 16), Line0, [noparse][[/noparse]" Counting Down...."]
LCDOUT (LCDpin // 16), Line1, [noparse][[/noparse]" Time Left"," " ,DEC3 dwn]
MAINIO
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
Yahoo! Groups Links