Programing in visualbasic - need help

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
giladbob
LCD?
Posts: 4
Joined: Fri May 22, 2009 7:15 am

Programing in visualbasic - need help

Post by giladbob »

hello,
i have a vk204 -25 usb and i don't know how to write text to it using visual basic according to the manual i need to send 0xFE 0x58 to clear screen
can anyone help me? i don't understand how to send the data
i'm using vb and the code is
serialport.write (&HFE)
serialport.write (&H58)
and it doesn't work
if u can send me example it will be helpful
:rock:
Clark
Matrix Orbital
Matrix Orbital
Posts: 881
Joined: Fri Aug 17, 2007 10:58 am
Location: Matrix Orbital
Contact:

Post by Clark »

Hi Giladbob,

I'm more of a C type languages guy myself, but I worked out a little program here for you this morning; it seems to work quite well.

Imports System
Imports System.IO.Ports

Module Module1

Dim WithEvents Port As SerialPort = New SerialPort("COM1", 19200, Parity.None, 8, StopBits.One)
Public Command As Byte() = New Byte(1) {254, 88}
Sub Main()
Port.Open()
Port.Write(Command, 0, 2)
Port.Write("Hello World!")
Port.Close()
End Sub

End Module

I always like to use the decimal equivalents when coding, but you should be able to throw in the hex values instead. You'll have to change your COM number to match the one your display is attached to; I'm guessing it'll be a higher number as you'll have a virtual serial port. You you're not sure, you can check out the number in your device manager.

If you have any further questions, just post, and I'll do my best.

Thanks,
~Troy
Troy Clark
Design & Development
Matrix Orbital
giladbob
LCD?
Posts: 4
Joined: Fri May 22, 2009 7:15 am

Post by giladbob »

hi
this was very helpful
can u help me with my project?
i trying to make equalizer using vb how can i get information about how to do it
'how to get data from media player - artist name,album name and ....

thx
Ray
Matrix Orbital
Matrix Orbital
Posts: 745
Joined: Thu Dec 13, 2001 4:00 pm
Location: Earth.... I think..
Contact:

Post by Ray »

Although we'd love to help everyone with all their programming issues we really can only give you support on interfacing with the LCD. For obtaining data from media player you are on your own. You might want to checkout something like LCD Smartie instead that already does a ton of these things.
Irish
LCD?
Posts: 2
Joined: Sun May 31, 2009 1:14 pm

Post by Irish »

Although this is not strictly LCD related, when I wanted to write details of what was playing in Windows Media Player to my Matrix Orbital LCD as part of a custom Visual Basic program, I used the following 'blogging plugin' which populates a registry key with the details of a song playing in WMP:
http://www.microsoft.com/windowsxp/down ... reate.mspx

I then adapted the C# code I found at Codeproject to read the relecant registry key.
http://www.codeproject.com/KB/system/re ... nitor.aspx
I then used the method used by Clark above to write the data I wanted to the LCD.

If you cannot manage to adapt the Registry Reader code from Codeproject for your own VB use, I may be able to share the very simple VB implementation I am using myself.
giladbob
LCD?
Posts: 4
Joined: Fri May 22, 2009 7:15 am

Post by giladbob »

hi, if u can share plz do cause i didn't understand how to do so
giladbob
LCD?
Posts: 4
Joined: Fri May 22, 2009 7:15 am

Post by giladbob »

hi im using windows 7 an media player 12 i cant install the bloger plz help :cry:
i will be very happy if u can share any code u have i want to make my own display for media center (i have the thermaltake medialab and i want to replace it)
Irish
LCD?
Posts: 2
Joined: Sun May 31, 2009 1:14 pm

Post by Irish »

I am afraid I do not know if the blogging plugin works with Windows 7 and WMP 12 - I am using it only with XP and WMP 11. I cannot offer help with this, you would need to look elsewhere - maybe Microsoft have an updated tool, or place this in a different registry key in Windows 7.

The following code works for me in XP and WMP 11, using the bogging plugin, and having added the dll from Codeproject into my VB program. It is partly taken from MS blogs and partly from the codeproject page referenced. It works for me but I cannot vouch for it as I am a very amateur coder, so I cannot offer any further guidance - maybe asking at a Windows Media Player or General VB forum elsewhere would be more fruitful.

Code: Select all

Public WithEvents registrymonitor1 As RegistryMonitor

    Public Sub StartMonitoring()

        Dim keyName As String = "HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\CurrentMetadata"
        registrymonitor1 = New RegistryMonitor(keyName)
        registrymonitor1.Start()
    End Sub

    Public Sub registrymonitor1_Error(ByVal sender As Object, ByVal e As System.IO.ErrorEventArgs) Handles registrymonitor1.Error
        Console.Write("error")
    End Sub

 Public Sub registrymonitor1_RegChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles registrymonitor1.RegChanged
        Console.WriteLine("REgistry Change Called")
        RefreshMetaData()
    End Sub

'The following subroutine is called when a song is started or stopped
    Public Sub RefreshMetaData()
        Dim newMetadataAvailable As Boolean
        Dim newAuthor, newTitle, newAlbum, newDuration As String
        Dim CurrentMetadata As RegistryKey

        'This tells the program what key to find the WMP Blogger info at
	CurrentMetadata = Registry.CurrentUser.OpenSubKey _
            ("Software\Microsoft\MediaPlayer\CurrentMetadata", _
                False)
             
        With CurrentMetadata
            newAlbum = .GetValue("Album", "No Album")
            newAuthor = .GetValue("Author", "No Author")
            newDuration = .GetValue("durationString", "No Duration")
            newTitle = .GetValue("Title", "No Title")
        End With

        If CurrentMetadata.ValueCount > 0 Then
            nowplaying = "playing"
            newMetadataAvailable = False
           
            If (newAuthor <> regline1) OrElse _
                 (newTitle <> regline2) Then
                m_Album = newAlbum
                m_Author = newAuthor
                m_Title = newTitle
                m_durationString = newDuration
                m_LastRefresh = Now

'This reads the data I want for the current playing song and puts it in a previously declared string that I can write to my matrix orbital LCD using the code Clark mentions above.
               
		string1 = m_Author
                string2 = m_Title
             End If
 
    End Sub
Post Reply