AmbientOrb::Serial - Perl module for interfacing with your Orb via serial port.
Version 0.02
This module allows you to do communicate with your ambient orb via serial port. Please see the reference manual at http://www.ambientdevices.com/developer/ if you want to delve a little deeper. The ambient orb home page can be found at http://www.ambientdevices.com/cat/index.html.
Tested only on a Win32 system, but it should work fine for a non-Windows host; just pass the constructor the /dev path of the port.
use AmbientOrb::Serial; my $orb = AmbientOrb::Serial->new( { port_name => COM1 } ); $orb->connect() or die "unable to connect to orb!"; $orb->color( ORB_RED ); #turn it red $orb->pulse( ORB_RED, ORB_SLOW ); #pulse it slow $orb->pulse( ORB_GREEN, ORB_FAST ); #pulse it fast ...
By default the constants for colors and animations are exported.
Constants are exported for the different colors and animations. Note that I'm mucking around directly with the symbol table and exporting these constants to main::ORB_RED, for example. I know. I'm bad. I'm sorry.
For example:
use AmbientOrb::Serial; print ORB_RED; #prints 'RED'
Lyle Hayhurst, <sozin at cpan.org>
<sozin at cpan.org>
Please report any bugs or feature requests to bug-ambientorb-serial at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=AmbientOrb-Serial. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-ambientorb-serial at rt.cpan.org
Need to add support for manual setting of RGB
Need to add support for getting orb diagnostics.
Probably need to have the thing pull out of serial mode when the port is disconnected.
And further on, create AmbientOrb::Web that supports the same feature set, except via the web interface.
You can find documentation for this module with the perldoc command.
perldoc AmbientOrb::Serial
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/AmbientOrb-Serial
CPAN Ratings
http://cpanratings.perl.org/d/AmbientOrb-Serial
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=AmbientOrb-Serial
Search CPAN
http://search.cpan.org/dist/AmbientOrb-Serial
Copyright 2006 Lyle Hayhurst, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
#public methods
Note that, as per the spec, the first thing it does is transmit a GT message to the orb. This will tell it to ignore wireless input and use the serial port input instead.
If all goes well, it returns a 1, else a 0.
It takes a single argument -- the color to turn it.
I'm actually lying here -- it can take an optional third argument, the pulse frequency. But if you want to pulse the orb you might as well use the pulse() function, if only for code readability.
It takes a two arguments -- the color to turn to, and the pulse frequency.
To install AmbientOrb::Serial, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AmbientOrb::Serial
CPAN shell
perl -MCPAN -e shell install AmbientOrb::Serial
For more information on module installation, please visit the detailed CPAN module installation guide.