11-10-2011 01:29 PM - edited 11-10-2011 01:29 PM
I am trying to create a scanning GUI that scans through an array of buttons (Rows) and then when an Arduino switch is pressed, the button in the array (row) that is highlighted is recorded. After the row is selected, the same thing happens to the Columns Array.
I am having trouble reading the Arduino values at the same time as the buttons highlight.
Solved! Go to Solution.
11-10-2011 01:35 PM
Is that DrexelDragon as in Drexel in Philly? So how is Drexel these days? Wonder if Moshe Kam is still teaching there.
As to your query: I haven't a clue what you're trying to do. I don't see any connection between the "pin" that you're reading and the array of LEDs. Why did you set up 2 loops? If you're just trying to update a Boolean array you should use a shift register in your single loop and simply perform a Replace Array Subset to update the array.
11-10-2011 01:42 PM
Yes Drexel University. Moshe Kam is still here. Haha.
The value is 0 while the button is open. When I press the button, the value goes to 1. I was trying to stop the boolean array during its incrementing cycle, then record that index.
Overall, I am trying to pick a certain row and certain column when I press the button. The idea was to cycle through a boolean array until the row that I want is lit, I press the button and that stays lit. Then I move on to select a column in the same process.
I hope this is clearer.
11-10-2011 01:45 PM
Your "Value" value change event will not fire. It will only fire if it is a control and a user changed the value. It will not work if you update the value of an indicator with a wire like that. What you can do is create a Value(Signaling) property node and write to that. But it is preferable to use a user event or send the data to another loop via a queue. But for a simple application the Value(Signaling) property method is probably ok.
(Right click on the indicator and select Create/Property Node/Value(Signaling)
11-10-2011 02:00 PM
I tried to queue the data over but I get an error in the dequeue element in the Row selecting loop.
11-10-2011 02:17 PM
The error is because a value other than zero causes the bottom loop to stop. Then the queue is released when that loop exits. When that happens the reference to the queue in the top loop becomes invalid throwing an error.
Do something similar to this to make sure the queue is only released after everyone is done with it.
11-10-2011 02:37 PM
Still no luck with sending the data. I replaced the value with a control so that I can troubleshoot w/out setting up the Arduino.
11-10-2011 03:47 PM - edited 11-10-2011 03:48 PM
As soon as you enqueue any number greater than zero the top loop will stop. Are you sure you don't want not equal to zero?
In any case that is a bad way to stop the loop unless you know there is one value that will never be part of your data. Some "sentinal" value.
I wrote a micronugget on stopping multi-loop applications. In your application you could just create a local variable from the stop button and read that in your upper loop. It means you have to change the mechanical action to switching.
11-10-2011 04:01 PM
The Arduino will either read a 0 (off) or 1 (on) and is a push button so that it is always off unless pressed.
As long as the value is 0, the loop should keep cycling through the row array.
11-10-2011 04:35 PM
A few things: