
' ----------------------------------------------
'  Commands to Theremino_Motors
' ----------------------------------------------
' EnableConnection
' DisableConnection

' ResetAllMultiturnValues
' ResetAllCalibrationValues

' Calibrate Motor x To nn.n


' ----------------------------------------------
'  SLOT TEXT for COMMANDS
' ----------------------------------------------
Variable Numeric Slot_Commands = 50

' ----------------------------------------------
'  BUTTONS
' ----------------------------------------------
Button 1 Label EnableConnection
Button 2 Label DisableConnection

Button 4 Label ResetAllMultiturnValues
Button 5 Label ResetAllCalibrationValues

Button 7 Label "Calibrate Motor 1 To 0"
Button 8 Label "Calibrate Motor 1 To 30"
Button 9 Label "Calibrate Motor 1 To 60"
Button 10 Label "Calibrate Motor 1 To 90"

Button 12 Label ShowWindow

Gosub Loop
Stop

' ----------------------------------------------
'  LOOP
' ----------------------------------------------
Label Loop
	'Variable String Response
	'Response = SlotText(Slot_Responses)
	'Print Response
	Wait Seconds 0.1
Goto Loop


' =============================================================
'  SEND COMMAND (default timeout = 0.5 Sec)
' =============================================================
Label SendCommand
	Variable Numeric SC1       '<-- Parameter Destinat.-Slot
	Variable String  SC2       '<-- Parameter Command-String
	Variable Numeric SC3 = 0.5 '<-- The timeout in seconds
	Variable Numeric SC4
	SlotText SC1 = SC2
	For SC4 = 0.1 To SC3 Step 0.1
		If SlotText(SC1) = ""
			Exit
		EndIf
		Wait Seconds 0.1
	Next
Return

' ----------------------------------------------
'  COMMANDS
' ----------------------------------------------
Label EnableConnection
	SendCommand(Slot_Commands)("EnableConnection")
Return

Label DisableConnection
	SendCommand(Slot_Commands)("DisableConnection")
Return

Label ResetAllMultiturnValues
	SendCommand(Slot_Commands)("ResetAllMultiturnValues")
Return

Label ResetAllCalibrationValues
	SendCommand(Slot_Commands)("ResetAllCalibrationValues")
Return

Label Calibrate Motor 1 To 0
	SendCommand(Slot_Commands)("Calibrate Motor 1 To 0")
Return
Label Calibrate Motor 1 To 30
	SendCommand(Slot_Commands)("Calibrate Motor 1 To 30")
Return
Label Calibrate Motor 1 To 60
	SendCommand(Slot_Commands)("Calibrate Motor 1 To 60")
Return
Label Calibrate Motor 1 To 90
	SendCommand(Slot_Commands)("Calibrate Motor 1 To 90")
Return

Label ShowWindow
	SendCommand(Slot_Commands)("ShowWindow")
Return


'WATCH v1
'EXEC DestX = 12
