-
Notifications
You must be signed in to change notification settings - Fork 130
Items K8055
See original
This is the MisterHouse client interface for my K8055 interface board daemon. Once you have created a K8055 object, you must tell it which input ports you are interested in using the doUpdate... methods.
$k8055 = new K8055;
if ($Reload) {
$k8055->doUpdateDigital(4);
$k8055->doUpdateAnalogue(2);
}
Whenever the value of these ports change, $k8055->state_now
will return the name of the port that has changed (i.e. 'digital 4'). The state of each port is checked every 10 seconds (by default, can be changed).
Use the write... methods to change the value of the output ports.
K8055 daemon MisterHouse Interface http://www.velleman.be/ot/en/product/view/?id=351346
#k8055_host - Hostname that is running k8055d.
#k8055_port - Port on hostname to which daemon is listening.
Method | Description |
---|---|
state_now |
For one pass, will return the name of the input port that has just changed. ' if ($state=$k8055->state_now()) { <br/> if ($state eq 'digital 5') {<br/> speak "The digital 5 port just changed value";<br/> } |
if ($state eq 'counter 1') {`<br/>` speak "Counter number 1 just changed";`<br/>` }`<br/>` if ($state eq 'analogue 2') {`<br/>` speak ("Analogue port 2 now reads ".$k8055->readAnalogue(2));`<br/>` }`<br/>` }` |
| readAnalogue, readDigital, readCounter
| Returns the value of the given port as read on the last check.
`
| writeAnalogue, writeDigital
| Sets the value of the output ports. # sets analogue port 2 to 143/255 x 5V (i.e. 0=0 V, 255 = 5 V).
$k8055->writeAnalogue(2,143);
|
| resetCounter
| Resets the given counter. # resets counter 2
$k8055->resetCounter(2);
|
| setDebounce
| Sets the debounce of each counter in milliseconds. # sets the debounce of timer 1 to 350ms
$k8055->setDebounce(1,350);
|
| doUpdateAnalogue, doUpdateDigital, doUpdateCounter
| Tells the object to care about the given port(s). If this command isn't called, then the corresponding read... method will always return -1 and the state variable will never be set.
`
| setUpdatePeriod
| Sets how often we update the input port readings. Defaults to 10 seconds. # input ports will be read every 2 seconds.
$k8055->setUpdatePeriod(2);
|
| getUpdatePeriod
| Gets the current auto update period in seconds. print "current update period is ".$k8055->getUpdatePeriod()." seconds";
|
| update
| Immediate requests updated values from the ports that we are interested in. Note that the data will not immediately be available on return from this method as updates are asynchronous. $k8055->update();
|
Matthew Williams
None