Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello, I am fairly new to the world of visual basic programming and am writing a visual basic code to turn on LED's on my Panel PC. My question is how do I access the IC address through my code ? I have the LED API and it defines the IC addr as a byte, now if I have a addr which goes by the name C4 how do I write this to the above byte datatype ?

Thank you very much for your help!
Posted
Comments
Sergey Alexandrovich Kryukov 16-Feb-15 16:50pm    
Which LEDs? Which LED API? What would be the purpose of such "API"?
—SA
Member 11456687 16-Feb-15 19:34pm    
Hello Sergey, I have a Panel PC which has LED's on its side - I want to write a code in Visual Basic which lights up these LED's if some condition is met (say a alarm or trip in my mechanical system). The LED API is the module VB code provided the manufacturer which has some user defined structures on how to call the addresses (see the code below). If you look at the Main addr, it is defined as a byte and the LED addresses are of the form C4, C6, C8...
Thanks for your help !
Please excuse my ignorance on the subject and let me know if you have more questions.


Module LEDBAR_API
Public Const Brightness_StepRange As Integer = 8 '0 ~ 8

Public Structure LEDBARAPI_SMB_INFO
Public count As Byte 'reserve not use
Public addr As Int16 'SMBUS device address
Public command As Int16 'SMBus command
Public data As ULong 'Read/Write data
End Structure

Public Structure LED_COLOR
Dim Color_Level As Integer
Dim IC_Addr As Byte
Dim LED_Addr As Byte
End Structure


Public Structure LEDBARAPI_LED_INFO
Dim Main_Addr As Byte 'Main address
Dim R_LN As Byte 'Red list number
Dim G_LN As Byte 'Green list number
Dim B_LN As Byte 'Blue list number
End Structure

Public Structure LEDBARAPI_LED_COLOR
Dim LED_Info As LEDBARAPI_LED_INFO
Dim R_LEVEL As Integer
Dim G_LEVEL As Integer
Dim B_LEVEL As Integer
End Structure

Public Structure LEDBARAPI_LED_COLOR_PWM
Dim LED_Info As LEDBARAPI_LED_INFO
Dim R As Byte
Dim G As Byte
Dim B As Byte
End Structure



Public Declare Function SMB_WriteByte Lib "SMBAPI" (ByVal hSmb As IntPtr, ByRef pSmbInfo As LEDBARAPI_SMB_INFO) As Boolean

Public Declare Function LIGHTBAR_DriverInit Lib "IBS_LEDCTRL" () As IntPtr
Public Declare Function LIGHTBAR_DriverUninit Lib "IBS_LEDCTRL" (ByVal hSmb As IntPtr)

Public Declare Function LIGHTBAR_DeviceInit Lib "IBS_LEDCTRL" (ByVal hSmb As IntPtr) As Boolean
Public Declare Function LIGHTBAR_DeviceClose Lib "IBS_LEDCTRL" (ByVal hSmb As IntPtr) As Boolean

Public Declare Function LIGHTBAR_Brightness_Single Lib "IBS_LEDCTRL" (ByVal hSmb As IntPtr, ByRef LEDINFO As LEDBARAPI_LED_COLOR, ByVal INFO_Size As Integer) As Boolean


End Module
Sergey Alexandrovich Kryukov 16-Feb-15 19:51pm    
Well, I don't have this API and don't even know the purpose of these LEDs. I hope you have some documentation on this API...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900