Read each button from a gamepad

Hi, what I would like to do is read input from a usb gamepad  and change a Color box and change text infront of the box. However, the controller outputs a t/f for each button.
(Button 1,2,3,4 will change color, and 5,6,7,8 will determine what text will display over the color box( 4 diff text displays))
My problem is how do I say "Def. If neither 1,2,3,4 are presses-black, If button 1 is pressed-blue, If button 2 is pressed-green...etc..."
I have tried a case structure, but they can only say T/F once, which would be fine but the color box can only accept one input... I have attached a picture of what I have that wont work, I need an alternative...
Thank you, 
Brent S.
Attachments:
Visual.PNG ‏26 KB

Since your data is already a cluster you can use the Cluster to Array, then use the seach 1D array for a True eliminating the need for the build array.
Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

Similar Messages

  • Reading each value from spreadshee​t file with delay (multiple rows and columns)

    Hi,
    a) I want to read EACH VALUE from a spreadsheet file having multiple rows and columns WITH DELAY. I am attaching my VI and sample datalog file for reference (tempsensor.txt).I need to do so because as soon as I read put ON the Sensor button on front panel, LV reads all the values at one go. I need the values for each temperature to be displayed after a delay.
    b) Secondly, I would like to read another file containing the state of four antennas (deployed:1; undeployed:0). I am logging state of each antenna in each column of the file(magnet.txt) I need to have four LEDS on front panel to display state of the antennas. I dont know what I have done for antennas in my VI is right or wrong. I guess thats rhe wrong way to approach the problem. Please help!!!(column1: Antenna1 state ; Column2:Antenna2 state.. and so..on..)
    Any help would be greatly appreciated!!
    Thanks in advance,
    Ratnesh
    FYI: The first column in my datalog file represents timestamp(number of seconds elapsed), second column: reading for temperature sensor 1, third column: reading for temperature senosr 2, and so on. I am using approx. 11 temperature sensors.
    Also, I have generated the log files for the reference purpose only. They do not represent the actual values. They are far away from actual values.
    Attachments:
    01032005.zip ‏30 KB

    Look at this modified version of your VI. After looking at it, I determined that a shift reggister was not required in this case.
    Lynn
    Attachments:
    MultiSensors.2.vi ‏85 KB

  • Reading Each String From a text File

    Hello everyone...,
    I've a doubt in File...cos am not aware of File.....Could anyone
    plz tell me how do i read each String from a text file and store those Strings in each File...For example if a file contains "Java Tchnology forums, File handling in Java"...
    The output should be like this... Each file should contains each String....i.e..., Java-File1,Technology-File2...and so on....Plz anyone help me

    The Java� Tutorials > Essential Classes: Basic I/O

  • Reading each keystroke from a console app?

    I'm using Sun JDK 1.3.0_02 on RedHat Linux 7.1.
    I've written a console application (no GUI, no Swing), from which I need to read each keystroke from the keyboard as it is typed.
    My loop basically waits (blocks) on System.in.read(), and disposes of each byte as it is read.
    Unfortunately, the way the app executes, my Java app doesn't seem to be given any keyboard input until the user presses ENTER. In addition, each keystroke is echoed to the console display, which I don't want.
    Can anyone point me in the right direction to solve this? I can't use any GUI components as this needs to be a console app.
    Thank you,
    Bryan

    This can be fixed with a tiny JNI program. As long as the 'c' call getch() works the same on all platforms:
    // The Java class
    import java.io.*;
    public class ConsoleInputStream extends InputStream
        public native int read();
        static
            System.loadLibrary("ConsoleInputStream");
    // The JNI header
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class ConsoleInputStream */
    #ifndef _Included_ConsoleInputStream
    #define _Included_ConsoleInputStream
    #ifdef __cplusplus
    extern "C" {
    #endif
    #undef ConsoleInputStream_SKIP_BUFFER_SIZE
    #define ConsoleInputStream_SKIP_BUFFER_SIZE 2048L
    /* Inaccessible static: skipBuffer */
    * Class:     ConsoleInputStream
    * Method:    read
    * Signature: ()I
    JNIEXPORT jint JNICALL Java_ConsoleInputStream_read
      (JNIEnv *, jobject);
    #ifdef __cplusplus
    #endif
    #endif
    // The JNI 'C' code
    #include "..\classes\generated source\consoleInputStream.h"
    #include "conio.h"
    JNIEXPORT jint JNICALL Java_ConsoleInputStream_read(JNIEnv * env, jobject obj)
        return getch();
    // The test program
    public class Console
        public static void main(String[] args)
            try
                System.setIn(new ConsoleInputStream());
                while(true)
                    int ch=System.in.read();
                    if(ch=='\r')
                        break;
                    else
                        System.out.print((char)ch);
            catch(Exception ex)
                ex.printStackTrace();
    // the build script (Windows)
    cl -I\j2sdk1.4.0\include -I\j2sdk1.4.0\include\win32 ConsoleInputStream.cpp /MD /LD user32.lib /link/out:..\classes\ConsoleInputStream.dllHope this helps :)

  • Using jsp to read a input from a radio button

    i am trying read a input from a radio button ,normly if the name of radio button is "priority" and if u referrence it as request.getParameter("priority") it shld work right but mine does not.
    <% rs = stmt.executeQuery("select PRIORITYNAME,PRIORITYDESC from TBL_PRIORITY ");
    <td>Priority</td>
    <% while(rs.next())
    %>
    <input name="priority" type="radio"><% out.println(rs.getString(1)); %><% out.println(rs.getString(2)); %><br>
    <%
    %>
    is it bcs i am using a loop !! bcs am populating the radio fields from a database

    i am trying read a input from a radio button ,normly
    if the name of radio button is "priority" and if u
    referrence it as request.getParameter("priority") it
    shld work right but mine does not.
    A couple of things not necessarily addressing your problem, but still..
    Avoid too much Java code in the JSP. Use existing tags or write new custom tags to do the task.
    Avoid database access form the JSP itself, if possible.
    <% rs = stmt.executeQuery("select
    PRIORITYNAME,PRIORITYDESC from TBL_PRIORITY ");
    <td>Priority</td>
    <% while(rs.next())
    %>
    <input name="priority" type="radio"><%
    out.println(rs.getString(1)); %><%
    out.println(rs.getString(2)); %><br>
    <%
    %>
    I'm not quite sure what are you trying to do with the above. You want the labels of the radio buttons to be obtained from the database as well as their values, is it?
    Does PRIORITYNAME correspond to the value of the radio button and PRIORITYDESC correspond to the label of the radio button?
    If that's the case, I think you need to do it as follows:
    Radio button is declared as follows in HTML
    <input name="priority" type="radio" value="<%rs.getString(1)"%>><%rs.getString(2)%></input>
    is it bcs i am using a loop !! bcs am populating the
    radio fields from a databaseNo

  • I have read 118 files (from a directory) each with 2088 data and put them into a 2 D array with 2cols and 246384row, I want to have aeach file on a separate columns with 2088 rows

    I have read 118 files from a directory using the list.vi. Each file has 2 cols with 2088rows. Now I have the data in a 2 D array with 2cols and 246384rows (118files * 2088rows). However I want to put each file in the same array but each file in separate columns. then I would have 236 columns (2cols for each of the 118 files) by 2088 rows. thank you very much in advance.

    Hiya,
    here's a couple of .vi's that might help out. I've taken a minimum manipulation approach by using replace array subset, and I'm not bothering to strip out the 1D array before inserting it. Instead I flip the array of filenames, and from this fill in the end 2-D array from the right, overwriting the column that will eventually become the "X" data values (same for each file) and appear on the right.
    The second .vi is a sub.vi I posted elsewhere on the discussion group to get the number of lines in a file. If you're sure that you know the number of data points is always going to be 2088, then replace this sub vi with a constant to speed up the program. (by about 2 seconds!)
    I've also updated the .vi to work as a sub.vi if you wa
    nt it to, complete with error handling.
    Hope this helps.
    S.
    // it takes almost no time to rate an answer
    Attachments:
    read_files_updated.vi ‏81 KB
    Num_Lines_in_File.vi ‏62 KB

  • How to handle multiple threads to read one line from a file each time?

    Dear Sir or Madam,
    I'm new to multiple threads java programming. What I want to do is as following:
    1. I'm writing a program to read one line of text from a very large file, and then do some process on this one line of text, then read the next line of text from this file, then process on this line of text, ...... When reach the end of the file, close the file.
    This is a single thread scenario.
    2. To fullly untilized computer resource, I want to create multiple threads to process this large file.
    One thing is very important is that each line of text in the large file has to be read sequentially. This means that the first line of text in the large file is read first, then the second line, then the third line ......
    My question is that if I create multiple threads to process the same file, how can I make sure that different threads will read the line of text from the same file sequentially?
    I don't have enough experience on java multiple threads programming, so it will be very appreaciated if you can help me on this as soon as you are available.
    Thanks and regards,
    Steven Wu

    A better solutoin would be to have a single thread that reads each line an puts it into a queue, and then multiple threads reading from the queue to process these lines.
    This will only be effective if the amount of processing to be done on each line is very large compared to how long it takes to read the line, or if you have more than one CPU on your machine.

  • Gif - file help: i don't want to read the gif each time from the file.....

    Hello there guys,
    i'm making a game and therefor i need to read a gif file like 20 times.
    i don't want my program to read the gif each time from the file, but only once.
    so i load it into an image or something?
    cuz opening the gif 20 times from my hard disk is a lot of time loss....
    opening it once and store it is much more efficient
    thx in advance
    plz help me out, cuz i don't really know how to do it.
    (in Delphi it's easy, but Java......)
    greetz,
    SpeciesXX
    Ramon Ribbe

    yes, it works, i used this code, thx man
    void button1_ActionPerformed(java.awt.event.ActionEvent event)
              ImageIcon image = new ImageIcon("f:/a.gif");          
              JLabel label = new JLabel();          
              label.setIcon(image);                    
              this.getContentPane().add(label);
              label.setBounds(10,10,100,100);
    and there i see my image :-)
    but 1 more thing, should i display all those blocks (images) on an applet, or should i use something else? (like what??)
    a sort of frame?
    because later on i have the field where all the blocks are in, and i have an area surrounding it, displaying all kinda information about the game, like how many lives remaining....
    can i put 2 applets in eachother? like applet1 is the parent of applet2?
    or should i use something else?
    plz help me, cuz java is kinda new to me i see....
    in delphi i just used 2 forms, form 1 with the blocks, form2 with the rest of info, and also being the parent of form1
    thx again, soon i can help ya guys too, i hope..
    (im learning java at school, but way too slow and to ez)
    Ramon

  • Why can't I read my emails from my iPad mailbox on my iPad today?Each message is replaced by the comment "This message has not been downloaded from the server."thank you

    Why can't I read my emails from my iPad mailbox on my iPad today?Each message is replaced by the comment "This message has not been downloaded from the server."thank you

    In which case, clearly communicating the intent would have been a better solution.  The steps do apply.  A more appropriate response would have been "tried that, no change".
    Regardless of whether they fixed the problem or not, they do apply.
    If English is not your native language, I would strongly encourage you to post in your native language going forward.
    If basic troubleshooting has not resolved the issue, the next step is to take the device to Apple for evaluation.

  • How to read each and every word from a string.

    Hi all,
       I have a string which is having many label numbers. if the string is lv_str, its value is like, 11111111111111##22222222222222##3333333333333.
    I need to move the values alone into internal table. each value should be updated as a single row into one internal table. How to read each and every word of the string and move to an internal table.
    the internal table should be like this.
    11111111111111
    22222222222222
    3333333333333
    Can any one give me a suggestion in this regard.
    POINTS PROMISED.
    Regards,
    Buvana

    Hi,
    If you know the format and length of the data
    Use split at '#' so that you will get the individual values.
    Thean append it to internal table.
    Reward iof helpful.

  • Read user groups from realm. Admin rights to each user ??

    Greetings to ALL,
    I am reading users, groups from realm. If I give the user admin priviliges I am
    able to get the information else I get the error weblogic.management.NoAccessRuntimeException:
    Access not allowed for subject: principals=[ruser1, B10AP01, B10MP01, B10MP03A,
    B10MP03], on ResourceType: Security:Name=myrealmDefaultAuthenticator Action: execute,
    Target: listGroups
    Is there more effective way to read the information.
    I can execute the program standalone ( from DOS PROMPT) and read all information
    if I do the following
    adminHome = (MBeanHome) Helper.getAdminMBeanHome (username,password,url);
    But when calling from the application I get the above error.
    Any code, suggestion will be very helpful.
    Fred

    "Fred Boon" <[email protected]> wrote in message
    news:3fa7cb98$[email protected]..
    >
    Greetings to ALL,
    I am reading users, groups from realm. If I give the user admin priviligesI am
    able to get the information else I get the errorweblogic.management.NoAccessRuntimeException:
    Access not allowed for subject: principals=[ruser1, B10AP01, B10MP01,
    B10MP03A,> B10MP03, on ResourceType: Security:Name=myrealmDefaultAuthenticatorAction: execute,
    Target: listGroups
    Is there more effective way to read the information.
    Commo mbeans require admin role in order to be able to invoke methods.
    I can execute the program standalone ( from DOS PROMPT) and read allinformation
    if I do the following
    adminHome = (MBeanHome) Helper.getAdminMBeanHome (username,password,url);
    But when calling from the application I get the above error.
    Try doing a runAs with a subject that has admin role.

  • How do I continually loop frames with a 20 second pause in each frame from the same scene without going to the next scene?

    How do I continually loop frames with a 20 second pause in each frame from the same scene without going to the next scene? There are buttons for the other scenes in these frames. The below works well until I am at the last frame in scene one, then it goes to the next scene and plays. How can I make scene one a continually loop.
    stop();
    var timer:Timer = new Timer(20000,0);//<--
    timer.addEventListener(TimerEvent.TIMER, timerHandler);
    timer.start();
    function timerHandler(event:TimerEvent):void {
        this.nextFrame();
        //or if you want to jump e.g 5 frames
        this.gotoAndStop(this.currentFrame+5);
    Thank you for any help.

    For this code to work, you need to empty the first frame and place all the photos a frame ahead. Then, place this code on the first frame. DONE!
    If you need more help, I'll try to answer it the fastest I can.
    Oh, and I could actualy make your photos fade out and fade in as they rotate from frame to frame, it would be awesome. Just tell me if you want me to do it. Good luck
    import flash.display.Scene;
    import flash.events.TimerEvent;
    stop();
    var timer:Timer = new Timer(2000,0);
    timer.addEventListener(TimerEvent.TIMER, timerHandler);
    timer.start();
    function timerHandler(event:TimerEvent):void {
    if (this.currentScene.name == "Scene 1") {
      if (this.currentFrame != this.currentScene.numFrames) {
       this.nextFrame();
      } else {
       this.gotoAndStop(2);
    nextFrame();

  • Mainstage is reading my buttons together instead of separate.

    I use the M-Audio Oxygen 88 MIDI controller with Mainstage 2.  When I try to assign a screen control to a button on my MIDI controller, it reads the buttons together so that every button performs the same action.  I don't know if the problem is with the hardware or with the software, or if I am simply not doing something correctly.  I have followed all the instructions in the manual.  If anyone knows what the problem is or why it is happening, that information would be greatly appreciated.

    Hi
    Sounds like the controller keyboard is sending out the same MIDI messages for each button?
    You need to check what messages are being sent from the controller, and make sure that they are different for each  button/fader etc. The easiest way to do this would be using the MIDI activity monitor in Mainstage, but there may be an editor program for the Oxygen that wouldl help (or the 3rd party MIDI Monitor app).
    CCT

  • Adding a URL button from XML file

    I'm making a photo slideshow that pulls info from an XML
    doc--including a URL. What is the code to add a link on a Flash
    button from an XML document?
    Here's my XML code for each photo: <url>
    http://www.yahoo.com</url>
    My Flash doc pulls all xml url's in an array like this:
    function loadXML(loaded) {
    if (loaded) {
    xmlNode = this.firstChild;
    image = [];
    description = [];
    url = [];
    delay = [];
    total = xmlNode.childNodes.length;
    for (i=0; i<total; i++) {
    image
    = xmlNode.childNodes.childNodes[0].firstChild.nodeValue;
    description
    = xmlNode.childNodes.childNodes[1].firstChild.nodeValue;
    url
    = xmlNode.childNodes.childNodes[2].firstChild.nodeValue;
    delay
    = xmlNode.childNodes.childNodes[3].firstChild.nodeValue;
    }

    Thank you! :)
    Do you happen to know how to open the link into a new browser
    window using the dynamic link? Putting "url" for the url returns a
    browser error "url not found on server".

  • How to stop 'refresh' button from 'submitting' in advance?

    Hi,
    I am trying to create a web page that shows a list of records to be updated individually by a click of its button.
    I realised that the records are 'updated' again when the page is refreshed!
    Basically the codes are like this:
    html>
    <title>Activate Users</title>
    <head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
    <link rel="stylesheet" type="text/css" href="stylesheet.css">
    <body bgcolor="#FFFFFF">
         <Form name= "activate" action="./activated.jsp" METHOD="GET">
    <%try{ %>
         <%@ include file="./connect/makeCon.jsp" %>
    <TABLE BORDER=1 width="75%" border="1">
    <TR><TH>Userid</TH><TH>Name</TH><TH>Status</TH><TH>Activate</TH></TR>
    <%
         PreparedStatement stmtt = ocon.prepareStatement("Select * from studentacct where studentacct_status=?");
    stmtt.setInt(1,2);     
         ResultSet rc = stmtt.executeQuery();
    %>
    <%
    while(rc.next()){
         String userid=rc.getString("studentacct_userid");//column names must be exactly the same as that in the database.a
    String name=rc.getString("studentacct_name");
    int status=rc.getInt("studentacct_status");
    %>      
         <TR><TD><%out.println(""+userid);%></TD>
    <TD><%out.println(""+name);%> </TD>
    <TD><%out.println(""+status);%></TD>
    <TD><INPUT TYPE="Submit" VALUE="Activate"></TD>
    </TR>
         <%     PreparedStatement stmtt2 = ocon.prepareStatement
                                  ("UPDATE studentacct set studentacct_status=? where studentacct_status=2");
    stmtt2.setInt(1,1);
              ResultSet rc2 = stmtt2.executeQuery();                    
         } %>
    </TABLE>
    <BR>
    <%@ include file="./connect/closeCon.jsp" %>
    <%     }catch(Exception e){
              System.out.println(e.getMessage());
              e.printStackTrace();
    %>
    <BR>
    <%@ include file="footer.jsp" %>
    </body>
    <script language="JavaScript">
    <!--
    window.open = SymRealWinOpen;
    //-->
    </script>
    </html>
    The connection to the database is succesful, but I am not sure if I should use Javascript or is there something wrong with my codes ?
    Please help thanks!

    First, tou have several items from the select statement, right? So you have several rows in the table, all with a submit button. When you click the submit button, how do you know what submit button was clicked? There is nothing in that code that would let you know what button for what row was picked. So that is one problem. Without solving that problem you can't handle anything else.
    You can do one of two things:
    1) Make each row, or each button table cell, a form where you have a hidden field that contains some identifying info so you know which thing you are submitting.
    2) Use one select button for the whole table and have radio buttons or checkboxes to allow selection of which to submit.
    Then on the server side, the page the form submits to should check that the form values were submitted and if so, do the DB updates.
    Second, there is no need to be running an update statement for each item selected (in the loop of DB rows). If you do like I mentioned above, you can get rid of that part.

Maybe you are looking for