Home Projects AVR Programming Guides Electrical Fundamentals Insteon Saving Electricity

Recent Updates

EasyGrow Greenhouse
Follow our adventure of assembling an 8x12 EasyGrow Greenhouse.
AVR Programming Guides
We have some nice AVR code samples to share. Lots of AVR goodies like timers, interrupts, and pin I/O for the beginner.
Watts Tables
Use these tables to help you determine how much various items in your house cost you by the day, month, and year.
Saving Electricity
A list of a variety of ways to help you save money by learning how much it costs to run things.
What is a Kilowatt Hour
Saving money on your electric bill starts with understanding what a kilowatt hour is.
How To Measure Watts
Learn a variety of ways to measure watts in your house.
Read Your Power Meter
By reading your power meter you can get a good idea of how much various electrical devices cost you.
Electronics Fundamentals
Learn some basic electronics fundamentals and see if you enjoy the field of electronics.














Turn Insteon Devices On and Off with Visual Basic 6

Make sure you have already followed the instructions to Add Insteon Support to Visual Basic.

You should already have the following code:

Option Explicit
Dim WithEvents sm As SDM3

Private Sub Form_Load()
    ' create a new instance of the SDM
    Set sm = New SDM3Server.SDM3
End Sub

' this sub will be called when the
' PLC receives an Insteon Event

Private Sub sm_OnText(ByVal Text As String)
    Debug.Print Text
End Sub

Now we are going to add a command button, and put the command to turn a light on to 100% brightness:

Private Sub Command1_Click()
    ' tell the device to turn on
    sm.SetOnLevelText "07.B1.12", "100%"
End Sub

The function SetOnLevelText is used to turn a device on and off. Simply pass the device ID as the first parameter, and the desired level as the second parameter, followed by the % sign.

You are now ready to create a project that will control the Insteon in your house using Visual Basic.

 

Jason Bauer

Written by

Jason Bauer is an owner and programmer for Portforward.com. He's allergic to twitter and facebook, but you can find more of his articles in the Guides section.
 
Friday, 20-Oct-2017 10:48:45 PDT