LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting with digital input reading Ardunio digital pin

Hi guys,

 

So what i'm trying to do is to count a digital input from an arduino,

When the pin is given a high input the loop should increment once, and should continue to increment as long as the pin is written low and then high again.

Basically it will serve to count digital inputs read from an encoder into the arduino input pin, and should increment (only once) each time the digital pulse is sent

 

Any advice incrementing with a digital input, ive been trying the whole day but cannot get it to work

The VI Untitled.pngAny help will be greatly appreciated

0 Kudos
Message 1 of 8
(5,271 Views)

Does this resembles to what you are expecting?(Attachment)

You have to put 'Loop' indicator wire in the shift register

Message 2 of 8
(5,245 Views)

I only want it to increment once when the digital input is written to high, not to continually increment.

Thanks for the reply

 

0 Kudos
Message 3 of 8
(5,236 Views)

Use the boolean value which you are getting after equal operator as case selector to case structure.

Thanks
uday
Message 4 of 8
(5,233 Views)

Oh..!! I missed that one

Message 5 of 8
(5,230 Views)

I still cannot seem to get the counter to increment by changing the digital input,

 

I included a timeout to allow change of input and arduino to read the change, because if there was no timeout the case structure would never be satisfied as arduino wont be able to read1.png2.png3.png4.png

0 Kudos
Message 6 of 8
(5,210 Views)

Since the Arduino does not have a "real" counter input that would only count on pulse transitions (rising or falling edge) you might want to consider using one of the analog inputs and watching for the voltage to cross a certain threshold (rising or falling) that way your only get one count per pulse.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 8
(5,204 Views)

Did you unerstand how event structure works? Look into some free tutorials.

Coming to your problem:

-Keep the loop variable as shift register like in other images you posted to outer loop.

-Just after the digital read connect it to equal to 0 and then pass to case structure.

-Please don't add another loop or event structure without knowing how it works.

test_5.png

Thanks
uday
Message 8 of 8
(5,199 Views)