1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
| '--- JB_USB1REL.BAS
'--- Demo pengontrolan modul relay USB-1REL
'--- Chandra MDE - Teknik Elektro Links
'--- 28 September 2014
nomainwin
WindowWidth = 300
WindowHeight = 355
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
groupbox #main.groupbox1, " Relay Control: ", 15, 15, 170, 72
button #main.btnRelayOn, "ON", [btnRelayOnClick], UL, 25, 40, 70, 30
button #main.btnRelayOff, "OFF", [btnRelayOffClick], UL, 105, 40, 70, 30
groupbox #main.groupbox2, " Relay Trigger/Off-Delay: ", 15, 100, 170, 196
button #main.btnRelayOnFast, "ON-OFF Very Fast", [btnRelayFastClick], UL, 25, 130, 150, 30
button #main.btnRelayOn50, "ON - 0.5s - OFF", [btnRelay50Click], UL, 25, 170, 150, 30
button #main.btnRelayOn1, "ON - 1s - OFF", [btnRelay1Click], UL, 25, 210, 150, 30
button #main.btnRelayOn5, "ON - 5s - OFF", [btnRelay5Click], UL, 25, 250, 150, 30
button #main.btnExit, "EXIT", [btnExitClick], UL, 200, 20, 78, 277
statictext #main.telinks, "http://teknikelektrolinks.com", 14, 302, 200, 20
open "JustBASIC - Demo Kontrol USB-1REL" for dialog as #main
print #main, "trapclose [quit.main]"
print #main, "font Arial 9 Bold"
print #main.telinks, "!font Verdana 8"
wait
[quit.main]
close #main
end
[btnRelayOnClick] 'Perform action for the button named 'btnRelayOn'
run "USB1RC.EXE R1", hide
wait
[btnRelayOffClick] 'Perform action for the button named 'btnRelayOff'
run "USB1RC.EXE r1", hide
wait
[btnRelayFastClick]
run "USB1RC.EXE R1 r1", HIDE
wait
[btnRelay50Click]
run "USB1RC.EXE R1", hide
timer 500, [tmr500ms]
wait
[tmr500ms]
timer 0
run "USB1RC.EXE r1", HIDE
wait
[btnRelay1Click]
run "USB1RC.EXE R1", hide
timer 1000, [tmr1000ms]
wait
[tmr1000ms]
timer 0
run "USB1RC.EXE r1", hide
wait
[btnRelay5Click] 'Perform action for the button named 'btnRelay1Off'
run "USB1RC.EXE R1", hide
timer 5000, [tmr5000ms]
wait
[tmr5000ms]
timer 0
run "USB1RC.EXE r1", hide
wait
[btnExitClick] 'Perform action for the button named 'btnExit'
Close #main
wait
|
Belum ada tanggapan untuk "Mengontrol Relay Via USB Menggunakan BASIC dan USB-1REL"
Post a Comment