-
Notifications
You must be signed in to change notification settings - Fork 131
Items example_interface
ggodart edited this page Jan 2, 2021
·
1 revision
See original
Here is an example of reading/writing using this object: '`` perl $test_example1 = new example_interface('string_on', ON); $test_example1 ->add ('string_off', OFF);
print "Example 1 data received: $state\n" if $state = state_now $test_example1; set $test_example1 OFF if new_second 5;
Here is another example
```perl
$interface = new example_interface;
$interface ->add('out123', 'request_status');
$interface ->add('in123', 'door_open');
set $interface 'request_staus' if $New_Second;
speak 'Door just opened' if 'door_open' eq state_now $interface;
You could also query the incoming serial data directly:
if (my $data = said $interface) {
print_log "Data from interface: $data";
}
Methods (sub) 'startup' or 'serial_startup' are automatically called by mh on startup.
example_interface_module = example_interface
example_interface_port = COM9
Defined in items.mht
as
# DEVICETYPE, name, groups, others
MYDEVICE, Lounge_lamp, Lounge, Parameter1
Or in code as
Method | Description |
---|---|