NAME
AmbientOrb::Serial - Perl module for interfacing with your Orb via serial port.
VERSION
Version 0.01
SYNOPSIS
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
...
EXPORT
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'
AUTHOR
Lyle Hayhurst, <sozin at cpan.org>
BUGS
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.
TODO
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.
SUPPORT
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
CPAN Ratings
RT: CPAN's request tracker
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
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.
FUNCTIONS
#public methods
connect The connect method will attempt to establish a serial port connection with the orb.
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.
color The color method instructs the orb to change its color.
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.
pulse The pulse method instructs the orb to change its color and pulse.
It takes a two arguments -- the color to turn to, and the pulse frequency.