Category Archives: Lingo

Serial Call-and-Response (Director/Lingo)

It runs this checking routine repeatedly (in the exitframe or idle), so that if there are some bytes, but not a full three, it skips the whole routine and goes about its other business.This example uses Geoff Smith’s SerialXtra version 1.0 for Director. The full version of the Director code can be downloaded as a Director .dir file here, or as a text file (the main movie script) here.Lingo side:on exitFrame doSerial go the frameend on doSerial — see if the port’s been opened: If serialObject.isPortOpen() then If serialObject.charsavailable() = 0 then –send a byte to ask for data SerialObject.writeChar(“A”) End if If SerialObject.charsAvailable() >=3 then –first byte sent by microcontroller: MyVar = SerialObject.readNumber() –next byte sent by microcontroller: MyVar2 = SerialObject.readNumber() –third one sent by microcontroller: MyVar3 = SerialObject.readNumber() end if end if end The microprocessor is reading its sensors, then listening for a byte of data from the Director program. Continue reading

Posted in Lingo | Comments Off on Serial Call-and-Response (Director/Lingo)