Device::Chip::MAX44009 - chip driver for MAX44009
Device::Chip::MAX44009
use Device::Chip::MAX44009; use Future::AsyncAwait; my $chip = Device::Chip::MAX44009->new; await $chip->mount( Device::Chip::Adapter::...->new ); await $chip->power(1); sleep 1; # Wait for one integration cycle printf "Current ambient light level is %.2f lux\n", scalar await $chip->read_lux;
This Device::Chip subclass provides specific communication to a Maxim Integrated MAX44009 ambient light sensor attached to a computer via an I²C adapter.
The reader is presumed to be familiar with the general operation of this chip; the documentation here will not attempt to explain or define chip-specific concepts or features, only the use of this module to access them.
$config = await $chip->read_config
Returns a HASH reference containing the chip config, using fields named from the data sheet.
HASH
CONT => bool MANUAL => bool CDR => bool TIM => 800 | 400 | 200 | 100 | 50 | 25 | 12.5 | 6.25
await $chip->change_config( %changes )
Writes updates to the configuration registers.
Note that these two methods use a cache of configuration bytes to make subsequent modifications more efficient.
$lux = await $chip->read_lux
Reads the latest light level conversion value and returns the value in Lux.
Paul Evans <leonerd@leonerd.org.uk>
To install Device::Chip::MAX44009, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Device::Chip::MAX44009
CPAN shell
perl -MCPAN -e shell install Device::Chip::MAX44009
For more information on module installation, please visit the detailed CPAN module installation guide.