Simple counter in seconds
Hello
In my code, I have a while loop which may or may not take more than x seconds to run. Once the while loop has worked for x seconds I would to provide a series of commands. Therefore, I need a kind of counter. Number of cycles will help me with that? If so, how? If this is not the case, how can I create a counter for this simple task? Thank you.
Alfredo
Yes, the number of cycles can be used for this, and other mechanisms. For example, you can use the time to get the seconds. Here are some simple examples:
Tags: NI Software
Similar Questions
-
Simple counter/dashboard (AS3)
I need this for a simple iPhone app...
I tried to create a dashboard for my iPhone with Flash CS5 in the Air for the iOS mode. I have add the timer and the timer of 24 seconds, but now I need help so much.
Problems:
1. when the timer reaches 0 mins, it only displays: 59, not 00:59
2. I tried to add a button to the meter of the points, but it seems very complicated in AS3 (not in AS2 :/). I created a TLF read only text named "HomeScore. But it is a nonnumeric string, so I can't add a simple counter.
4. I need help with the reset (timer and 24 seconds) and Start/Stop buttons (for the timer and 24).
My code:import flash.events.MouseEvent; (true) Seconds.text = "06:00" var timer:Timer = new Timer(1000,360); timer.addEventListener(TimerEvent.TIMER, countdown); timer.start(); function countdown(event:TimerEvent) { var totalSecondsLeft:Number = 360 - timer.currentCount; Seconds.text = timeFormat(totalSecondsLeft); } function timeFormat(seconds:int):String { var minutes:int; var sMinutes:String; var sSeconds:String; if (seconds > 59) { minutes = Math.floor(seconds / 60); sMinutes = String(minutes); sSeconds = String(seconds % 60); } else { sMinutes = ""; sSeconds = String(seconds); } if (sSeconds.length == 1) { sSeconds = "0" + sSeconds; } if (sMinutes.length == 1) { sMinutes = "0" + sMinutes; } return sMinutes + ":" + sSeconds; if (seconds/60 <= 0 && sSeconds != 0) { return "00" + ":" + sSeconds;} if (sMinutes = 0 && sSeconds = 0) { return "00:00"} } Possesso.text = "24" var timer2:Timer = new Timer(1000,24); timer2.addEventListener(TimerEvent.TIMER, countdownpossesso); timer2.start(); function countdownpossesso(event:TimerEvent) { var totalSecondsLeft:Number = 24 - timer2.currentCount; Possesso.text = timeFormatpossesso(totalSecondsLeft); } function timeFormatpossesso(seconds:int):String { var sPossesso:String; if (seconds > 59) { sPossesso = String(seconds % 60); } else { sPossesso = String(seconds); } if (sPossesso.length == 1) { sPossesso = "0" + sPossesso; } return sPossesso; } import flash.events.*; HomeScore.text = "02" HomeScore.text = ScoreFormatHome(ScoreHome); var ScoreHome:Number function ScoreFormatHome(ScoreHome:Number) { var ScoreHome=1 if (ScoreHome <=9 ) {return "0" + ScoreHome} if (ScoreHome >=10) {return ScoreHome} } ButtonplusHome.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler); function fl_MouseOverHandler(HomeAdd:MouseEvent):void { ScoreHome++; }you have too many questions for a single thread, unless you're already pretty savvy:
1. when the timer reaches 0 mins, it only displays: 59, not 00:59
use a string formatter function.
2. I tried to add a button to the meter of the points, but it seems very complicated in AS3 (not in AS2 :/). I created a TLF read only text named "HomeScore. But it is a nonnumeric string, so I can't add a simple counter.You can convert strings to numbers using Number().
4. I need help with the reset (timer & 24 seconds) and Start/Stop buttons (for timer and 24).the timer class has you use reset(), start() and stop() methods. Follow with the start() method reset() method if you want to reset and start.
-
Hi team or,.
I am trying to program a simple counter, see Appendix vi. Every time the temperature higher than 55 c she should count + 1 if it goes below of-18 + 1 cold cycle. Not sure why the structure of the event, never reached into the tank.
Can someone help me pls.Thank you
MartinDEGBM24 wrote: don't know why the structure of the event, never reached into the tank.
This is because the value change event is not raised by you write to the Terminal.
1. you don't need a case of timeout.
2. you should have a value of Stop change event to stop your loop
3. you should have a change in the value of your temperature control event
4. you really should be using shift registers to keep your account of cycle instead of local variables
5 look at the Boolean value through PtByPt VI.
-
How to make a loop simple counter in labview 7.1?
I'm trying to teach me how to use labview 7.1, but having trouble finding how to use functions properly. I am trying to create a simple loop to count from 1 to 10 with a delay of 1 second between each number. I would be grateful the help!
Classes resumed?
The key words are 'loop' (try a loop FOR the palettte of structures), 'delay' (try a wait (ms) of the range of timing). Use a constant instead of diagram for the "1 second" (or 1000 ms). and use a digital display to show the current number (for example by using an indicator connected to a terminal of the loop iteration FOR). Given that [i] starts from 0, first use a primitive of + 1. Wire a constant at the end of the loop to determine the number of iterations. You should be able to determine the correct value, math or by trial and error.
Now try to gather all, shouldn't be too difficult. Where have you problems? Have you looked at the examples? Did you do tutorials?
Once you have a project, post it here and we can propose possible improvements.
-
I made a music playlist and saved. It was not the first time that I did. I then burned this playlist to a CD RW. When I put the CD in my CD drive, the display shows the track # and seconds count, but I have NO sound. What I am doing wrong?
Thank you. Bebop_911Hello
(1) windows operating system you are using?
(2) what music player do you used to save the playlist?
(3) the playlist saved in what format?
(4) program which has been burning the CD from?
(5) you have the sound on the computer?
Suggestions for a question on the help forums
http://support.Microsoft.com/kb/555375
Response to us with information required for you help to solve the problem.
-
Simple counting the stopwatch will not stop.
Hello
I made a simple countdown timer, it works fine but I wish I had the sign next to the number % so it would look like a pre-order. But as I add the '%' sign to the function, the counting stops (100% more) ever and continues to count.
What Miss me?
var count: Number = 1;
var myTimer:Timer = new Timer (10);myTimer.addEventListener (TimerEvent.TIMER, count);
myTimer.start ();function countdown(event:TimerEvent):void {}
myText_txt.text = String ((count) + myTimer.currentCount);
myText_txt.text = String ((count) + myTimer.currentCount)+'%';
If (uint (myText_txt.text) > = 100) {}
myTimer.removeEventListener (TimerEvent.TIMER, count);
}
}Thank you!
You should learn to use the trace() function to see why things don't work as expected. The '%' is converting it to a uint not what you expect. Trace uint (myText_txt.text) and you'll see why comparing the value of a string uint digital a number isn't going to work. Try instead the following...
var count: Number = 1;
var myTimer:Timer = new Timer (10);myTimer.addEventListener (TimerEvent.TIMER, count);
myTimer.start ();
function countdown(event:TimerEvent):void {}
myText_txt.text = String ((count) + myTimer.currentCount) + '% ';
If (uint (String (+ myTimer.currentCount (County))) > = 100) {}
myTimer.removeEventListener (TimerEvent.TIMER, count);
}}
-
Using the mouse click simple counter
Purpose to make a mouse click counter. (a simple button clicker/tally, which keeps the number of clicks a user sets).
- Progress-
- Done button
- variable passed to the completed text field.
- correct variable pass script to the incomplete text field.
- Done button
- Problem-
1 counter variable remains at 1 and does not increase by 1 when the button is clicked.
script
var myVar = 0;
button_1.addEventListener (MouseEvent.CLICK, fl_ClickToPosition);
var fl_TF:TextField;
var fl_TextToDisplay:String = myVar;
function fl_ClickToPosition(event:MouseEvent):void
{
fl_TF = new TextField();
fl_TF.autoSize = TextFieldAutoSize.LEFT;
fl_TF.background = true;
fl_TF.border = true;
fl_TF.x = 100;
fl_TF.y = 100;
fl_TF.text = fl_TextToDisplay;
addChild (fl_TF);
myVar ++;
}
any help is greatly appreciated.
Thank you
Try:
var myVar = 0;
button_1.addEventListener (MouseEvent.CLICK, fl_ClickToPosition);
var fl_TF:TextField;
fl_TF = new TextField();
fl_TF. AutoSize = TextFieldAutoSize.LEFT;
fl_TF. Background = true;
fl_TF. Border = true;
fl_TF.x = 100;
fl_TF.y = 100;
fl_TF. Text = String (myVar);
addChild (fl_TF);function fl_ClickToPosition(event:MouseEvent):void
{
myVar ++;
fl_TF. Text = String (myVar);
} - Progress-
-
Hi, I'm just getting started in LABView and I am a very slow learner. I have build a counter to count my gamepad operations as it is cycling on a tester of life. I put him in place to count the individual directional activations, but I join to have it count total cycles. I'm writing up to the VI I did so far. How can I do that after that he been rolled once in each direction (up, left, down, right), there is a cycle? Thank in advance for any help.
-Pascale
I think the only problem is that it's a loop so fast (10mS) at the point where the counter increments he already counted the next event. You can add additional logic to prevent the inside while loop to stop until the direction of the joystick Returns Boolean 0. The idea is that stop only once all 4 have been activated AND 4 are no longer in an active state. I used the function NOT to make it more obvious that the logic was, you have also the output of arithmetic consisting be reversed but this watch only upward like a small point on the line of the value.
Like the other post, I don't have a way to test this, but I think my logic was scientifically.
Edit1: The post above beat me to it, and his suggestion would work just as well as mine, we just thought it differently.
Edit2: I noticed in one of your posts above you mentioned that you want to count only when it has been activated in a certain order. This VI does not work like that, it would take a more complicated logic to do. I see two ways that could be made, but don't have the time to get out to see which would be best. Good luck and have fun.
-
Hey guys,.
I just need a quick review on meter simple app. The main idea is that when the user clicks the button (+) the meter is incremented + 1 and when the user clicks the button (-) it decrements. In any case the value should be between 1-11 and should be in sequence, which means 1-2-3-4...-11 or conversely oder 11-10-9...-2-1... so I came up with this solution that I join you, but I want to know if there is a much simpler way to do this.
Best regards
-
Windows 10 has crashed on my computer, and to get the machine working again, I got enable smoothing on all applications. Now, I have to re - install Lightroom 6 (the standalone version rather than the flavor of cloud creative). How do this without it being treated as my second installation? Thanks for any help you can give.
You're not... but you can contact Adobe to have your adjusted number of activations
Serial number and activation support (non - CC) https://forums.adobe.com/thread/2041990
-
just a simple movie of second 7
What I'm trying to do is create a short film containing 7 jpegs that will slowly and GENTLY melted chained in the other on my index page. I want to run once when the page opens and stop at the end of the last remaining visible image. I ' ve tried every tutorial I can find Adobe, using Flash and Lynda.com.» I can now do balls bounce, things change the shape, images to be bland in or out and many other things. But I cannot find anywhere just some simple instructions on how to make a nice clean little film that will make what I'm after. What I'm after is a bit like what is available at www.showitfast.com, except that I don't want the film to continue to operate. I just want that it run once and stop at the end. Can someone point me to some tutorials that I may have missed? It doesn't seem like it should be that big a deal. I can get something close in Image Ready, but the file ends up being huge, no matter how I adjust the images. I can't find a method of interpolation in Flash that does the same thing the interpolation makes in Image Ready.
Thank you...If I understand correctly what you want, it might help:
1. place each of the 7 images on a separate layer.
2. each of the layers must have his picture (as a clip) placed further down the time line. Let's say that image 1 shows the frame 5 of layer 1. Image 2 appear first on frame 30 on layer 2 and so on for all seven layers.
3. use the _alpha set to display each image from 0 to 100 and then return to 0. That it will disappear in a, then press.
4. If you ride the ins and fade outs, images, you can get what you want.
5. you can adjust the speed by giving images more or less frames between each of them.
6. make sure that you put a "stop();" in the last film fram or he will repeat. -
Question on simple counting in oracle code
have two tables table1 and table2
Table 1A 5000 documents, table2 has 10000
There is a column called num_id (number)
in white table1
There is a column in table2 num_id (number) with a number of seq data in table2 and the last num_id = 10000
just take the max (num_id) table2 and begin the process of table1 with 10001, 10002, 10003, etc..
Thank you
DougHi Doug,.
Suppose you want to use the sequence.nextval to update the table 1 then all you need is...declare
vn_max_seq table2.num_id%type;
vn_counter table2.num_id%type;Start
Select max (num_id) in the vn_counter from table2;
-
I found this function
SELECT
TRUNC (86400 *(date_to-date_from))-60 * (trunc ((86400 *(date_to-date_from)) / 60));
TRUNC ((86400 *(date_to-date_from)) / 60)-60 * (trunc (((86400 *(date_to-date_from)) / 60) / 60));
TRUNC (((86400 *(date_to-date_from)) / 60) / 60)-24 * (trunc (((86400 *(date_to-date_from)) / 60) / 60) / 24)),
TRUNC (((86400 *(date_to-date_from)) / 60) / 60) / 24)
IN tempsSec, tempsMin, timeHr, heureDAY
FROM DUAL;
Nice and easy compare two dates and return the (time) difference as 13 hours, 40 minutes, 10seconds
now, my system shows delays like this from 10:00 to 10:19 (which is the duration of 9 seconds if you use the function above).
now, what I tried to do is to add 1 second of time, since there are between 10:00 and 10:19 actuially 10 seconds elaps (0 to 1 (1 second), 1-2 (1 second)...)
so I tried to just add a seconds before the date_to
SELECT date_to + 1/24/60/60 INTO date_to FROM DUAL; -Add a second because 00 09 is 10 seconds of display time (not 9!)
but sometimes, this provides a valid information, sometimes when counting only seconds each presents a wrong time, so there is an obvious mistake, I do somewhere...Rather than trying to debug the code you posted, it is probably easier to convert dates to timestamp, subtract the timestamps whiich returns an interval and extract the components of the interval.
Note that I add 1 second in the inline query. For the subtraction normal timestamp, you who would remove.
SQL> ed Wrote file afiedt.buf 1 with x as ( 2 select to_date( '10/24/2009 10:05:10', 3 'MM/DD/YYYY HH24:MI:SS' ) date_from, 4 to_date( '10/24/2009 14:55:19', 5 'MM/DD/YYYY HH24:MI:SS' ) date_to 6 from dual 7 union all 8 select to_date( '10/24/2009 10:05:10', 9 'MM/DD/YYYY HH24:MI:SS' ) date_from, 10 to_date( '10/24/2009 10:05:29', 11 'MM/DD/YYYY HH24:MI:SS' ) date_to 12 from dual 13 ) 14 SELECT extract( day from interval ) days, 15 extract( hour from interval ) hours, 16 extract( minute from interval ) mins, 17 extract( second from interval ) secs 18 from ( 19 SELECT to_timestamp(to_char(date_to,'MM/DD/YYYY HH24:MI:SS'), 20 'MM/DD/YYYY HH24:MI:SS') 21 + interval '1' second 22 - to_timestamp(to_char(date_from,'MM/DD/YYYY HH24:MI:SS'), 23 'MM/DD/YYYY HH24:MI:SS') interval 24 FROM x 25* ) SQL> / DAYS HOURS MINS SECS ---------- ---------- ---------- ---------- 0 4 50 10 0 0 0 20
Justin
-
Counting of string separated by commas in the cells of a column
Hi all
Try to pass some of my Excel spreadsheets in numbers. I'd appreciate help with a specific string of text/number in the cells in a column. In the example below (no sheet of complete works) is a column, the packs work (WP01, WP02 and so forth)-which means work packs a particular Test & Validation document (e.g. TV-102) applies to.
I would like to be able to simple counting the number of occurrences, say "WP05", is applicable. If I use COUNTIF, on the "WorkPack" column, he has only the cells that contain only the string "WP05" (i.e. in the sheet, I work with, I know there are 22 entries for "WP05" in the column of pack work, but only the 14 account)
Note: I am building this on my MAC, but would like to be able to access and use these sheets on my iPad - don't know if that makes a difference.
Any suggestions / ideas?
Thank you in advance...
ATB Perry
ID
Paper group
WorkPack
TV-91
Validation of NFR
WP05 WP06
TV-102
Certificate of conformity
WP05 WP06
TV-103
Validation of NFR
WP05 WP06
TV-206
Test EN
WP05
TV-207
Test EN
WP05
TV-208
Test EN
WP05
TV-209
Test EN
WP05
TV-212
Certificate of conformity
WP01, WP02 WP03, WP04, WP05, WP06, WP07, WP08 MICROSOFT WINDOWS CURRENTVERSION, WP09, WP10, WP11, WP12, WP13, WP14, WP.15
TV-213
Validation of NFR
WP01, WP02 WP03, WP04, WP05, WP06, WP07, WP08 MICROSOFT WINDOWS CURRENTVERSION, WP09, WP10, WP11, WP12, WP13, WP14, WP.15
TV-214
Test EN
WP01, WP02 WP03, WP04, WP05, WP06, WP07, WP08 MICROSOFT WINDOWS CURRENTVERSION, WP09, WP10, WP11, WP12, WP13, WP14, WP.15
TV-215
Validation of NFR
WP01, WP02 WP03, WP04, WP05, WP06, WP07, WP08 MICROSOFT WINDOWS CURRENTVERSION, WP09, WP10
TV-308
Validation of NFR
WP01, WP02 WP03, WP04, WP05, WP06, WP07, WP08 MICROSOFT WINDOWS CURRENTVERSION, WP09, WP10, WP11, WP12, WP13, WP14, WP.15
TV-338
Test EN
WP05
Here's how I would approach (without more):
Add additional columns to your table (those titled "WP01',"WP02", etc.). Enter the names as shown
The first line is a heading row.
Also... Add an extra line at the end and make a footer row
D2 = (LEN ($C2) −LEN (REPLACE ($C2, D$ 1, ""))) ÷LEN ($1 D)
It's shorthand dethrone select cell D2 and type e (or copy and paste it here) the formula:
= (LEN ($C2) −LEN (REPLACE ($C2, D$ 1, ""))) ÷LEN ($1 D)
Select cell D2, copy
Select cells D2 the bottom of column R, paste
in the footer row (row 15 of this example) iff the following formula:
D15 = Sum (D)
Select the cell D15, copy
Select the cells D15 thru R15, dough
I could never find 22 WP05 instances (even when I search your message on this web page):
-
Expired the incorrect time format the seconds
Hello
The attached VI maintains channels of the passage of time and I'm having a problem with the format in the second section. It gives me 3 digits and not properly counting the seconds.
I would have only 2 digits for the seconds and the County properly under the name of 01, 02... 09, 10, 11... 59 (second section).
Could someone suggest a change to the attached VI?
Thank you
FRN
The reason that you do not see the correct number, it is that the value that you get out of the final Quotient function & rest isn't seconds and miliseconds.
Add one more Quotient & rest with a 1000 as y. Then take the floor(x/y) your seconds.
Maybe you are looking for
-
I don't want backups icloud or annoying jump - rises
I'm constantly being attacked by icloud pop ups, but I don't care about icloud, this isn't the center of my universe. I want these pop-up that annoys me about icloud backups get out. I went to settings-> icloud-> storage management and try to turn of
-
How to restore a site to the 'more VIsted' tab I have accidnetly deleted?
During the discussion of my sites 'most Visited', I accidentally checked "Forget this site" by mistake. How to UN-do this? Is there somewhere I can visit to see all my "forget this site" listed?
-
This may sound stupid, but how do you enable 32-bit 64-bit Mac browsing?
I need to run a 32-bit program but a 64.
-
Facebook application does not properly
Hello, since I got the update of my facebook application ICS does not work properly I try to post something, it crashes every time! Another question, why I am forced to use 4g with this new update of the ics? He eats my data faster I prefer to use th
-
Want to 700-074 video card recommendation
I start to play a MMO and he says my driver is low level. She still plays. There is no newer driver on the HP website and I can't load new driver Intel that HP has installed a driver(for stability) custom A more recent MMO starts in April with graphi