|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#3
|
|||||
|
|||||
|
Re: Digital I/O Help
The digital inputs on the RC will read as "1" when open, and "0" when grounded. They will directly detect contact closures to ground, such as a limit switch or an Allen-Bradley optical sensor.
If you want your code to count switch activations, you should remember that you only want to increment the count when the read value changes from 1 to 0. Code:
if (last_rc_dig_07 == 1 && rc_dig_07 == 0)
switch_counter++;
last_rc_dig_07 = rc_dig_07;
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Digital Caliper as a Digital Readout on Small Mill | sanddrag | Technical Discussion | 9 | 13-10-2005 22:51 |
| Dynamic Input/Output Changing | Paolo | Control System | 6 | 23-09-2004 19:09 |
| heres the code. y this not working | omega | Programming | 16 | 31-03-2004 15:18 |
| digital inputs not valid just after initialization? | WizardOfAz | Programming | 2 | 26-01-2004 13:21 |
| digital i/o connectors | Mercutio | Electrical | 4 | 19-01-2004 19:20 |