Giter Site home page Giter Site logo

cbpi_gpio_input's People

Contributors

mrillies avatar

Watchers

 avatar  avatar  avatar

cbpi_gpio_input's Issues

Add periodical value for good view in chart

Repeat the same value every 5 sec as other sensors does:

diff --git a/__init__.py b/__init__.py
index 0f6eb31..f4577d0 100644
--- a/__init__.py
+++ b/__init__.py
@@ -40,6 +40,7 @@ class GPIOinput(SensorActive):
 
     input_on = False
     latch_val = False
+    tic_cnt = 0
     
     def init(self):
         self.input_on = False
@@ -52,6 +53,7 @@ class GPIOinput(SensorActive):
             self.latch_val = trig_level[self.input_type]
             super(GPIOinput,self).init()
             print "Init Complete"
+           self.tic_cnt = 0
             self.data_received(self.out_val[self.input_on])
         except Exception as e:
             print e
@@ -70,6 +72,10 @@ class GPIOinput(SensorActive):
     def execute(self): 
         while self.is_running():
             self.api.socketio.sleep(.1)
+           self.tic_cnt = self.tic_cnt + 1
+            if  self.tic_cnt == 50:
+                self.tic_cnt = 0
+                self.data_received(self.out_val[self.input_on])
             #if GPIO.event_detected(int(self.gpio)):
             if self.trigger_val is not None:
                 # if we're here, an edge was recognized

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.