How to use a Timer and an event with LIFA/Arduino

Hello world

I feel that my question is going to sound really stupid, but I can't find the solution. I want to use my arduino to do two tasks at the same time. I want to use a while loop with a timer, read my pins in my arduino. It's really easy. But then, I like to use as a case of event do different type of things. In the example, I downloaded, I just use an event to activate my fan. Again, I have no problem to use it by itself. But I can't find a way to use both at the same time, especially when I want out of my application. Because I use my arduino inside my event, I put it in an another while loop. But I want also an another while loop, but uses the clock. In my example, if you use the tool to highlight run, see you clearly that my signal goes the while loop that contains the case of the event, but not other things that I want to use it as a timer. That's probably because I missed something on the architecture, it's just to give you an idea. I just want to know what is the smartest way to combine my case of the event and my time in a loop using the timer and how to close them correctly. I'm not an expert in Labview, so it is a bit difficult for me. If my comments seems obscure, I'll answer all your questions without any problem.

I thank very you much for your help and attention.

FrenchLizard wrote:

If you use the tool to highlight execution, you can clearly see that my signal goes the while loop that contains the occurrence, but not others

Because of the LabVIEW data flow model: value of stop button is connected to the first loop for the second loop. You can see "How to stop several loops using the only button" then you can use any implementation. http://digital.NI.com/public.nsf/allkb/267704CDE91156D186256F6D00711AAE

Tags: NI Software

Similar Questions

  • How to use the time of 80 MHz with the example of the soul base angular Position-buffer-Cont-Ext Clk.vi

    Hello:

    I use the card PCI-6602 and am a bit new to the use of timer/counters.  I use the Commission to measure the position of a quadrature encoder.

    I would use the time base internal 80 Mhz the map of 6602, but examples of LabVIEW will not allow that.  In the example, he States:

    2. call the DAQmx Schedule VI (sample clock) to configure settings of clock synchronization external sample Mode Sample and sample clock Source.  The sample clock Source will determine when a sample will be inserted into the buffer.  The 100 kHz, 20 MHz and 80 MHz time bases can serve as the sample clock Source.  The Edge parameter can be used to determine when a sample is taken.

    Is it possible to use the database internal time for my application?

    I have attached the example vi that I use.

    Thank you.

    Pat

    Hi, Pat.

    The rate determines how fast the samples are acquired and put on the material buffer.  This value depends on the basis of time, which is specified by the source of the VI DAQmx calendar entry.  The default source on the PCI-6602 map is the on-board clock (80 MHz).  The rate must be a divisor of the source.  For example, 80 MHz, 40 MHz, 20 MHz, 10 MHz,..., would be acceptable values for the entry rate.

    So the answer to your question would be to remove the entry from the source and ensure that the rate is a factor of the source.  Leaving this entry unwired will use the clock shipped by default of the unit, as shown in the screenshot below:

    I hope this helps.

  • How to use NI 9264 and NI 9205 with NI PXI-7813R and cRIO-9151

    Hello world

    I am currently working on an application in time real NI PXI-7813R (map FPGA) and NI PXI-8184 (on-board controller). They are all in an NI PXI-1031 chassis.

    I need to generate/receive analog signals.

    I already managed to use the SCB-68 with my NI PXI-7813R (FPGA card) to process digital signals. (Slot 0)

    Connector 1 and 3 of my FPGA I have respectively cRIO-9151 with NI 9264 for analog and cRIO-9151 output with NI 9205 for the analog input.

    • with NI 9264, I have on every 16 outputs-10, 5V (!) Isn't it supposed to be between-10 and 10V?), whether or not the vi runs. (But not when my PXI turned...)
    • with the NI 9205 module, I always get-32767 when the VI is running, regardless of pressure I apply. (I tested AI0 and AL10)

    Maybe is my hardware not configured properly? I did the configuration automatically, when I started the project, Labview detected the devices connected.

    Unfortunately, MAX does not seem to be useful because inputs and outputs are on the FPGA...

    Any idea?

    Thank you

    PS: VI on the FPGA is really basic, only read/write controls.

    Hello

    Back with the solution...

    My modules came! Each of them has been plugged in the wrong cRIO-9151.

    This must occur after the first configuration.

    I noticed when I right click on my fpga device > RIO Device Setup. I wanted to check the devices again, but crashed for Labview.

    I could also have seen 'Connector [number]' (automatically added by Labview) and the removal of material number (9205 or 9264) in the project and check if it really was what I had.

    Hope that my mistake will help someone in the future...

  • How to use a structure of the event with a state machine


    I don't know exactly what you're asking, but it sounds as if you want a bunch of script tests and if the user says stop, to immediately stop the current test and abandon others?  I'll assume you know how to clear the table so that it will not abandon the others, so I guess that you have wrong to abandon the current test?  If it is indeed the case, the problem is that you are not able to spread the message of the VI FP main which is the GUI for the sub vi which is the test where the test may or not have a GUI (FP visible) of its own.  Threading is the first thing to come to mind, but it will be may not need the use of events.

    You can do this by passing a refnum of the stop button to the Subvi, where you can then add to wait to the structure of business event.

    I have attached 2 screws, mainvi.vi which is just a loop displays the number * 2 (number of seconds since the race) to be called subvi.vi and then check to see if the button is pressed.  mainvi.VI is in no way a state engine, it's just a simple loop for demonstration purposes.  subvi.VI just waits 2 seconds and leaves, this is a better engine State structured with an init State to start a case of survey to wait events and an exit status to clean.  You can change everything as you wish so that he can do what you want.  You will notice that even if subvi.vi is running, it will automatically end when you press the stop button.

    I hope this helps.

    A

  • How to use Apple time machine to back up multiple pc, I have an ipad, hp (WINDOWS 7, AND the door of ENTRY WITH XP

    How to use Apple time machine to back up multiple pc, I have an ipad, hp (WINDOWS 7, AND the door of ENTRY WITH XP

    Hi David,

    Time Machine is a backup utility in built for the Mac operating system that works with your Mac and a (sold separately) external hard drive or Time Capsule airport. You can go through the article to get the idea of base on the application.

    The basics of the Mac: Time Machine

    http://support.Apple.com/kb/ht1427

    You can go through the items in the link for your reference.

    Time Machine

    http://www.Apple.com/in/support/TimeMachine/

    I suggest you to contact the Apple support forums for help on the issue.

    https://discussions.Apple.com/index.jspa

    Do not hesitate to contact us for any information related to Windows.

  • RunTimeException when you use the timer and TimerTask.

    In the switchNext() method, it changes an image and some text in a Vertical management. When I run the application, I get a RunTimeException. However, when I have not used the timer and tested the method switchNext() with just a button method worked perfectly. How can I make it work with timer or another class that he will call every 30 seconds?

     time = new Timer();
    TimerTask task = new TimerTask()
    {
    
    public void run()
    {
    
        switchNext();
    }
    };
    time.schedule(task, 10000);
    

    It would be useful to know what Exception you actually get.

    However, I think that it is indeed related to the fact IllegalStateException the TimerTask is running in the "bottom", and you try to update your User Interface.

    If you change the code as follows, it will work the method on the event Thread and so he has access to update the user interface.

    public void run()
    {
    UiApplication.getUiApplicat () .invokeLater (new Runnable()

    public void run() {}
    switchNext();

    }});
    }

    You can find more information on the event thread here:

    http://supportforums.BlackBerry.com/T5/Java-development/what-is-the-event-thread/Ta-p/446865

  • How to use the capture and the print button

    I tried to figure out how to use the capture and the "print" button, or add or what you call. I press it and the whole page of a different color changes, so I try to cut the section I want but I don't know how to send it to the printer. Can someone help me with this. I'm not at savvy with tech stuff, but when I find a recipe or something and it doesn't have an option to print a certain area, I can't understand how to use it?

    Thank you

    Andi Starbuck

    That happens to me is, I click and drag to make a rectangle of yellow selection, and as soon as I raise my finger on the mouse button, the part I've selected is captured as an image, a new tab opens and preview before printing, the image display. I can use the installation of the Page or simply print. But if I close the preview, this temporary image vanishes and I'm back on the page where I started. You see something different?

  • Hi all, someone could please describe how to use partition recovery and recovery disks

    Hello

    Could someone please describe how to use recovery partition and stage of recovery disks by

    step to restore the window to its factory settings 8, that I know what to expect until I take

    a dip. I have a HP laptop.  Thank you. English is my second language, so please be clear.

    Hello:

    Please read the info at the link below.

    http://support.HP.com/us-en/document/c03489643

    Paul

  • How to use this site and whre to find answer to my questtion?

    How to use this site and whre to find answer to my question?

    Well, you found how to ask a question, see the answers, simply click on your profile jake coll at the top right of any page name and look at my Questions.
     
     
  • How to use a timer in Director countdown to quit smoking

    How to use a timer in Director countdown to quit smoking

    Hi, you are welcome! Good luck!

  • How to use the adapter from the wall with my Mac Pro laptop?

    How to use the adapter from the wall with my Mac Pro laptop?

    The AC wall connector is not compatible with the outlet on the MBP?  As the MBP charger will work from 100v to 240v, a transformer is necessary.  You need a converter that connects to the power outlet home and is compatible with your MBP.  You can buy the Apple travel kit:

    http://www.Apple.com/shop/product/MD837AM/A/Apple-world-travel-adapter-Kit

    Or you can use a single specific converter for the geographical area:

    http://www.Amazon.com/orei-grounded-universal-adapter-Singapore/DP/B004SCSV2U/re f = sr_1_4? ie = UTF8 & qid = 1460735377 & sr = 8-4 & keywords = us + in + uk + power + adapter

    (it is a UK USA example)

    Or you can get the converter that adapts the charger directly:

    http://www.Amazon.com/HIOTECH%C2%AE-extension-charger-connecting-specification/d p/B00MA48JZW/ref = sr_1_3? ie = UTF8 & qid = 1460735486 & sr = 8-3 & keywords = us + in + uk + power + ad aptor + apple + charger + cord

    (again, this is for a UK plug.)

    Ciao.

  • Hello, I would like to know how to make horizontal sites and it moves with scrolling

    Hello, I would like to know how to make horizontal sites and it moves with scrolling

    The scrolling would work with the scrolling of the mouse.

    Site that you mentioned also uses the same movement of scrolling with the horizontal length long.

    This video could give the exact idea:

    https://www.YouTube.com/watch?v=x5YMbB1jMdY

    Thank you

    Sanjit

  • How to connect my Blackberry and my computer with Bluetooth?

    I was wondering how to connect my blackberry and my computer with bluetooth and I tried, but he will not find my device. I don't know how check that the Bluetooth software included with Windows.

    Hello

    ·        Who is the manufacturer of the system and what is the model?

    I suggest you to consult the tutorial that is mentioned below. You also have a section that tells you how to check that the Bluetooth software included with Windows. If your system has been installed on the Bluetooth system then the icon will appear in the notification area. If this isn't the case, you must install the Bluetooth drivers on the system.

    How to set up Bluetooth connectivity between a smart phone BlackBerry and BlackBerry Desktop Manager

    http://www.BlackBerry.com/BTSC/search.do?cmd=displayKC&docType=kc&externalId=KB04132

    I suggest you return the item mentioned below.

    Set up a Bluetooth compatible device

    http://Windows.Microsoft.com/en-us/Windows-Vista/set-up-a-Bluetooth-enabled-device

    Thanks and regards.

    Thahaseena M
    Microsoft Answers Support Engineer.
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Satellite M30X-122: how to use the headphones and speaker at the same time?

    Hello

    y at - it a possiblity to use headphones and speaker at the same time?
    When I plug the headphones into the Jack, the speaker is created off the coast of the moment.

    Thank you
    Peter

    Hi Peter,.

    There is unfortunately no way to use both headphones and speakers at the same time. This is because tghere's a disconnection physical power for the internal speakers when you plug in the headphones. It is not by software. The only way around this would be to dismantle the headphones Jack and solder connections that are broken when you insert the headphone permanently.

    Kind regards

  • How to use a structure of the event in a Subvi

    I am using a structure of the event within a Subvi.  The Subvi has a table constructor that built tables and the structure of the event is used so that when the program runs, it allows you to change the elements of the array.  It works, but when I apply within a Subvi, it does not work properly.  This goes into a Subvi, because it will be part of a much larger progrram, so it must be modular.

    If you are using a structure of the event, it is not a Subvi.  If you worry about modularity, you should not use the structure of the event.

    You seem to have a fundamental misunderstanding of modularity.  An event structure must be placed in a while loop.  If you have a while loop in a Subvi, you have transferred control of your program to the Subvi.  You are not at this stage modular.  Your higher level GUI has no control.  You would have to create a stupid system of variables to pass data down to the loop to stop the loop and return to your main VI.  This is not a good design decision.

    Instead of searching for a way to make something broken, you should spend effort trying to understand what you really want to accomplish.  You should also spend some time to learn how to work the event structures.

    This application is small at the moment and it is already on the way to the unreadable.  It's a terrible thing to do for you.  Break these habits now.  variables are only when absolutely necessary.  Using subVIs to accomplish individual tasks, do not run the entire application.  With the structures of the event, use a value of stop button change event for will not be held hostage to the time-out.  If your variable is '2' in it, you're doing something wrong.  It has to be something different between set points, put it in the name.  If you want to make the subVIs, create an icon.

    But first and foremost, invest time in understanding dataflow

Maybe you are looking for