#!/usr/bin/perl use Device::SerialPort 0.12; $ob = Device::SerialPort->new ("/dev/ttyS1") || die "S1 dead"; $ob->datatype("raw") || die "raw"; $ob->baudrate(2400) || die "baudrate"; $ob->parity("none") || die "parity"; $ob->databits(8) || die "databits"; $ob->handshake("none") || die "handshake"; $ob->write_settings || die "write settings"; #write to both lines of the LCD display #clear screen $ob->write("\xFE\x01"); $ob->write("Hello"); $ob->write_drain; #second line $ob->write("\xFE\xC0"); $ob->write("World"); $ob->write_drain; # These lines move the servo to 5 different positions sleep(1); $ob->write("\xFE\x90\xFF\x00\x01"); $ob->write_drain; sleep(1); $ob->write("\xFE\x90\xFF\x00\x11"); $ob->write_drain; sleep(1); $ob->write("\xFE\x90\xFF\x00\x21"); $ob->write_drain; sleep(1); $ob->write("\xFE\x90\xFF\x00\x31"); $ob->write_drain; sleep(1); $ob->write("\xFE\x90\xFF\x00\x41"); $ob->write_drain; #This loop should move the servo #nearly full range in 25 step #it doesn't. $x = 25; while ($x>0) { sleep(1); $ob->write("\xFE\x90\xFF\x00"); $ob->write(int($x*10)); $ob->write_drain; $x--; } #end