I am having a very hard time getting this to work. I'm going to give you the short version. I'm trying to build a gui in autohotkey to enter intigers then create a string and pass it to the arduino serial port and reading it using Serial.parseInt()
my arduino code works already using the serial monitor
and the autohotkey command example does NOT work on it's own
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; serial settings
ARDUINO_Port = COM4
ARDUINO_Baud = 9600
ARDUINO_Parity = N
ARDUINO_Data = 8
ARDUINO_Stop = 1
; setup arduino serial communication
arduino_setup()
InputBox, pulses, number of pulses., ,, 250, 180
InputBox, pulse_width, delay in Ms +2ms per relay ., ,, 250,180
InputBox, delay, delay in Ms +2ms per relay ., ,, 250, 180
if ErrorLevel
MsgBox, CANCEL was pressed.
else
MsgBox you entered "%pulses%.%pulse_width%.%delay%"
sleep,100
; storing the message box as copies of variables p pw and d
; making sure i can retreave them with meessage box and I can
p = %pulses%
pw =%pulse_width%
d = %delay%
sleep 1000
MsgBox you still entered "%p%.%pw%.%d%"
sleep, 50
arduino_send("%p%.%pw%.%d%")
;*************************************************************************************
; *****Do not edit below this line unless you want to change the core functionality of the script*****
;*************************************************************************************
; called when the gui is closed
;also called when program exits
GuiClose:
OnExit:
; make sure to cleanly shut down serial port on exit
arduino_close()
; this is important!! or else theprogram does not end when closed
ExitApp
#include %A_ScriptDir%\include\Arduino.ahk
;from autohotkey example
Msg box example you entered "500.12.12"
serial send ("500.12.12") ; is this sending byte data instead of DEC info?
arduino code using Serial.parseInt();
unsigned long x = Serial.parseInt();
int y = Serial.parseInt();
int z = Serial.parseInt();
x 500
y 12
z 12
the arduino autohotkey set up is coppied from here
any help would be awesome