Posts

Showing posts with the label perl

Pinguino and perl

You can use perl to communicate with Pinguino via USB. To do it you have to install libusb library and Device::USB module for perl. After that you can upload this program to Pinguino: testusb.pde: // USB Test // Marin Purgar marin.purgar@gmail.com // Use with led_on.pl and led_off.pl companion programs uchar cmd; void setup(void) {   pinMode(0, OUTPUT);   digitalWrite(0, HIGH); } void loop(void) {   if (USB.available()) {     cmd = USB.read();   }   if (cmd == 'N') {     digitalWrite(0, HIGH);   }   if (cmd == 'F') {     digitalWrite(0, LOW);   } } // EOF And you can create two perl programs to turn the LED on (sending the character 'N' to Pinguino) and off (sending the character 'F' to Pinguino): led_on.pl: #!/usr/bin/perl -w use strict; use warnings; use Device::USB; my $usb = Device::USB->new() || ...