Step 11Very simple PC programming
This project is brought to you by the magic of RobotBASIC. RobotBASIC (RB) is a free programming language and IDE (integrated development environment). It has support for controlling the USBmicro U451.
RB is free. FREE! You can write a program in the RB IDE and then save it as an .exe - a stand-alone executable that doesn't need the IDE to run. The USBm.dll is needed to go along with that file, but that is free, too.
I'm not going to get into the details of the program in this instructable. The entire program is the 35 lines in the image below. The program is easy to copy into the IDE and simply run. Here is the program as text: (note the spacing gets screwed up.)
// U451 relay control program
// If the DLL is found...
if usbm_DllSpecs() != ""
// And the device is found...
if usbm_FindDevices()
// Initialize the U451, outputs
n = usbm_DirectionB(0, 0xFF, 0xFF)
// Create title and two checkboxes for the relays
xyText 10,10,"Relay 1 Relay 2","",20,fs_Bold
for i = 0 to 1
addcheckbox "" + i, 10 + 120*(1-i), 60, " "
next
while true
for i = 0 to 1
if getcheckbox("" + i)
n = usbm_SetBit(0, i+8)
else
n = usbm_ResetBit(0, i+8)
endif
next
delay 100
wend
else
print "There are no Devices"
endif
else
print "The USBmicro DLL is not installed"
endif
| « Previous Step | Download PDFView All Steps | Next Step » |




















































RobotBASIC comes from http://www.robotbasic.org