5747 questions

6966 answers


7060 members

0 votes
552 views 1 comments
Is there a way to configue the Digital Input as a counter. To count the number of times the input was on and store that counter until polled. eg. poll once per hour or once per day?

1 Answer

0 votes

You can easyle write shell script which count digital input activity .

Just use gpio.sh for digital input tracking.

More information here:


The wiki link shows how to read the state. Where will I find info on writing a script that saves the counter variable to post it hourly and reset the value after I posted?

Meaning step 1: count the gpio.sh get DIN1  

Step 2: Save the counter in variable?:  for example where is the %ms saved so that I might be able to edit it or create my own variable like %inputcounter

Step 3: Post the variable to my server each hour and not on change of input state? That might mean that I must do it in my shell script, but I am really having a difficult time gathering information on what commands to run in the shell script if I want to complete this task.

Thanks in advance, any information regarding this will help immensely.