Jump to content

Recommended Posts

Posted

This is what I have so far, I'm not that great with arrays.

I need this so I can convert the dec to hex after the bin2dec finishes

Its for my relay board program I am righting

bin2dec()
Func bin2dec()
$bin = "1001"
if StringIsDigit ( $bin ) = 0 then return -1
$binsplit = StringSplit ( $bin, "")
msgbox(0,"",$binsplit[0])
$start = 1
For $i = $binsplit[0] To 1 Step -1
if $binsplit[$i] = 1 then
$start = $start * 2
$num = $start + $binsplit[$i]
msgbox(0,"",$num)
endif
Next
endfunc

Relay board program

#include <GUIConstants.au3>
;OFF = 0
;ON  = 1
GUICreate("MY RELAY", 260, 80)

$b1 = GUICtrlCreateButton (1, 10, 10, 30)
$b2 = GUICtrlCreateButton (2, 40, 10, 30)
$b3 = GUICtrlCreateButton (3, 70, 10, 30)
$b4 = GUICtrlCreateButton (4, 100, 10, 30)
$b5 = GUICtrlCreateButton (5, 130, 10, 30)
$b6 = GUICtrlCreateButton (6, 160, 10, 30)
$b7 = GUICtrlCreateButton (7, 190, 10, 30)
$b8 = GUICtrlCreateButton (8, 220, 10, 30)
$allon = GUICtrlCreateButton ("All ON", 70, 55, 60)
$alloff = GUICtrlCreateButton ("All OFF", 130, 55, 60)
$l1 = GUICtrlCreateLabel ("0", 20, 40)
$l2 = GUICtrlCreateLabel ("0", 50, 40)
$l3 = GUICtrlCreateLabel ("0", 80, 40)
$l4 = GUICtrlCreateLabel ("0", 110, 40)
$l5 = GUICtrlCreateLabel ("0", 140, 40)
$l6 = GUICtrlCreateLabel ("0", 170, 40)
$l7 = GUICtrlCreateLabel ("0", 200, 40)
$l8 = GUICtrlCreateLabel ("0", 230, 40)
GUISetState ()


; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
if $msg = $b1 then
        process()
    endif
if $msg = $b2 then
        process()
    endif
if $msg = $b3 then
        process()
    endif
if $msg = $b4 then
        process()
    endif
if $msg = $b5 then
        process()
    endif
if $msg = $b6 then
        process()
    endif
if $msg = $b7 then
        process()
    endif
if $msg = $b8 then
        process()
    endif
if $msg = $alloff then
For $i = 13 to 20
GUICtrlSetData ( $i, "0" )
Next        
    endif
if $msg = $allon then
For $i = 13 to 20
GUICtrlSetData ( $i, "1" )
Next
    endif
Wend

Func process()
$msg = $msg + 10
If GUICtrlRead($msg) = "1" Then
GUICtrlSetData ( $msg, "0" )
Else
GUICtrlSetData ( $msg, "1" )
Endif

endfunc
Check out ConsultingJoe.com
Posted

umm, u might wanna try in the support forum

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...