January 2002
Beginner
480 pages
13h 15m
English
The calibrate() function is called if the script
is started without the -l option. This function simply prints
a message, waits for the user to press Enter, and then goes into a
a gentle loop, emitting whatever value was polled from the light
sensor so the user can determine the pivot point:
sub calibrate {
my $rcx = shift;
print <<EOT;
Calibration mode.
Note the sensor values and decide on a 'pivot' value
above which 'no coffee' is signified and below which
'coffee' is signified.
End the calibration mode with Ctrl-C.
Press Enter to start calibration...
EOT
<STDIN>;
while (1) {
print $rcx->Poll(9, SENSOR), " ";
sleep 1;
}
}The output produced from this function can be seen in Figure 9-4.
Read now
Unlock full access