LS,
I'd like to use my IR-toy v2 to read my kamstrump 66C water heating meter.
I've found in the documentation that you can talk to this device using IR using serial communication. The cool part is that they even included a little VB example;
MSComm1.Settings = “300,E,7,2”
MSComm1.Output = “/#1”
Delay (10) “Wait to clear output buffer”
MSComm1.Settings = “1200,E,7,2”
Temp = MSComm1.Input
Because I use FHEM on a Pi for home automation, I'd like to use PERL to talk to the IR Toy.
I've made an attempt to translate the VB to perl;
#!/usr/bin/perl
use strict;
use warnings;
use Device::SerialPort qw( :PARAM :STAT 0.07 );
my $PORT = "/dev/ttyACM1";
my $ob = Device::SerialPort->new($PORT);
$ob->baudrate(300);
$ob->parity("even");
$ob->databits(7);
$ob->stopbits(2);
$ob->write_settings;
$ob->write("U/u");
$ob->write("/#1");
select(undef,undef,undef,0.01);
$ob->baudrate(1200);
$ob->parity("even");
$ob->databits(7);
$ob->stopbits(2);
$ob->write_settings;
while(1) {
my $byte=$ob->read(1);
print "$byte";
}
But this is not working, so has anyone a clear example on how to use the IR to in Perl to communicate over the serial port?
Thanks!
:)