Hi all

First post, so be gentle with me :)

I have been using Perl for many years with too much trouble, but I have only recently had to deal with Win32::OLE.

I am trying to control a Phidget USB Display board via Perl ( http://www.phidgets.com/products.php?category=15&product_id=1203 )

So far, no problems opening the device via OLE, and obtain the board serial number, set the backlight and cursor blink.

use Win32::OLE; $phidget = Win32::OLE->new("Phidget21COM.PhidgetTextLCD"); $phidget->Invoke("Open", -1); (check/wait loop here for "IsAttached") $serial = $phidget->{SerialNumber}; $phidget->{"Backlight"} = 1; $phidget->{"CursorBlink"} = 0;

but, when I try to set the text in the LCD display, I am having really issues trying to work out the VB to Perl equivalent of this:

TextLCD.DisplayString(0) = "hello"

where "TextLCD" is the "$phidget" OLE object I have opened. I have tried just about everything I can think of, and must be missing something really obvious:

#does nothing $phidget->Invoke('DisplayString', (1,"hello")); $phidget->Invoke('DisplayString', (2,"goodbye")); #again, does nothing $phidget->{"DisplayString"} = (1,"hello"); $phidget->{"DisplayString"} = (2,"goodbye"); #still does nothing $phidget->DisplayString(1, "hello"); $phidget->DisplayString(2, "goodbye"); #This still does nothing $phidget->{DisplayString}[0] = "hello";

If it runs, it does nothing. If it doesnt run, it spits out:

Win32::OLE(0.1707) error 0x8002000e: "Invalid number of parameters" in PROPERTYPUT "DisplayString" at phidget-test.pl line 30

Is there anyone here at the Monastery who can enlighten me to my glaring mistake?


In reply to Win32::OLE / Perl / Phidget Display code by SteveL

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.