LivingColors script

Forum over Homeseer scripts (DUTCH forum)

Moderators: TANE, Ruud

Post Reply
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

LivingColors script

Post by AshaiRey »

The Arduino that controls the LivingColors lamp get it's command via the com port. De Arduino code expects commands like w0-255-255-255. These specific commands can be found in the Arduino code or requested via the serial terminal.

The Living Colors lamp is controled via a terminal program like HyperTerm. The downside of this is that the commands can't be scripted. To overcome this problem i use this small piece of code.

Code: Select all

     Public Sub Main(ByVal Parms As Object)
         '-------------------------
         'Get commandline arguments
         '-------------------------
         Dim CmdLine = Parms & Chr(13)
         Dim ComPort = 6             'Use this com port

         hs.CloseComPort(ComPort)    'Close the serial port in case it's hanging
         hsp.WaitMS(400)             'Sometimes fails to obtain a 
handle if there is no pause

         Dim Status
         Status = hs.OpenComPort(ComPort, "9600,n,8,1", 1, "", "")
         If Status <> "" Then
             hs.writelog("Error opening COM" & ComPort, Status)
         Else
             hs.writelog("COM6", "Com port" & ComPort & " setup complete")
         End If

         hsp.WaitMS(2000) 'Wait for the Arduino to get ready

         
'---------------------------------------------------------------------------------------------------------
         ' Arduino serial buffer cannot take more than 32 characters;
         ' writing a character to eeprom takes about 11 ms (assuming 
that there is no serial.prints in the loop);
         ' therefore, after each batch of 10 chars sent to COM, we 
should wait no less than 110 ms;
         
'---------------------------------------------------------------------------------------------------------
         hs.SendToComPort(ComPort, CmdLine)
         hsp.WaitMS(4000)            'Let the Arduino process the data
         hs.CloseComPort(ComPort)    'Close the serial port
     End Sub
rwitkamp
Member
Member
Posts: 70
Joined: Thu Apr 03, 2008 6:34 am
Location: Netherlands

LivingColors script

Post by rwitkamp »

Nice script, now I need to find a complete module top control my Livingcolor lamps. Any idea where I can buy it?
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

LivingColors script

Post by AshaiRey »

A good starting point for more information would me here http://www.domoticaforum.eu/topic.asp?TOPIC_ID=2264
Post Reply

Return to “Homeseer Scripts Forum”