Jump to content

TestingA

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by TestingA

  1. Hi again,😇 i was trying to send a multiple variables($ValueA,$ValueB) to Arduino with AutoIT but i can't find any solotion how to do it. Autoit Code: #include <CommMG.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Misc.au3> $vDLL = DllOpen("user32.dll") ;Conncet to Arduino Global $CMPort = 3 Global $CmBoBaud = 9600 Global $sportSetError = '' Global $CmboDataBits = 8 Global $CmBoParity = "none" Global $CmBoStop = 1 Global $setflow = 2 _CommSetPort($CMPort, $sportSetError, $CmBoBaud, $CmboDataBits, $CmBoParity, $CmBoStop, $setflow) If @error Then MsgBox(16,"Error!","Can't connect to Arduino on port - "&$CMPort) Exit EndIf _CommSetRTS(0) _CommSetDTR(0) Local $ValueA = Random(0, 1270, 1) Local $ValueB = Random(0, 1909, 1) While 1 If _IsPressed("1B") Then Exit ;ESC key If _IsPressed("10", $vDLL) Then ;SHIFT key Send_Value_To_Arduino() EndIf WEnd Func _ExitFunction() Exit EndFunc Func Send_Value_To_Arduino() _CommSendData($ValueA & $ValueB) ; Here is my Problem... EndFunc Arduino Code: void setup() { // put your setup code here, to run once: Serial.begin(9600); } void loop() { if (Serial.available()) // send data only when receive { int data = Serial.read(); // Read received data if (data) { Serial.println(data); //output $ValueA & $ValueB } } }
  2. Thank you, works perfect. 😇
  3. Hi, can anyone help me please? i wan't to know how do i use "_IsPressed" with arduino. My AutoIT script doesn't work when i press Shift key. Im using ELEGOO UNO R3 Mikrocontroller Board ATmega328P ATMEGA16U2 AutoIT Code: #include <CommMG.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Misc.au3> $hDLL = DllOpen("user32.dll") ;Conncet to Arduino Global $CMPort = 3 Global $CmBoBaud = 9600 Global $sportSetError = '' Global $CmboDataBits = 8 Global $CmBoParity = "none" Global $CmBoStop = 1 Global $setflow = 2 _CommSetPort($CMPort, $sportSetError, $CmBoBaud, $CmboDataBits, $CmBoParity, $CmBoStop, $setflow) If @error Then MsgBox(16,"Error!","Can't connect to Arduino on port - "&$CMPort) Exit EndIf _CommSetRTS(0) _CommSetDTR(0) While True If _IsPressed("10", $hDLL) Then LED_BLINK_10() ;If Shift is pressed call Func. EndIf WEnd Func _ExitFunction() Exit DllClose("user32.dll") EndFunc Func LED_ON_OFF() _CommSendByte(1) EndFunc Func LED_BLINK_10() _CommSendByte(2) ;Blink 10 Times EndFunc Arduino code: char Address; int LEDPIN = 13; int LEDSTATE = 0; void setup() { Serial.begin(9600); while (!Serial); Serial.println("Waiting for data...\n"); pinMode(LEDPIN, OUTPUT); digitalWrite(LEDPIN, LOW); } void loop() { while (Serial.available() > 0) { Address = Serial.read(); if (Address == 1) ONOFF(); if (Address == 2) BLINK(); } } void ONOFF() { if(LEDSTATE == 0) { //if is pressed digitalWrite(LEDPIN, HIGH); LEDSTATE = 1; } else { //if not pressed digitalWrite(LEDPIN, LOW); LEDSTATE = 0; } } void BLINK() { for (int i=0; i <= 9; i++){ digitalWrite(LEDPIN, LOW); digitalWrite(LEDPIN, HIGH); delay(100); digitalWrite(LEDPIN, LOW); delay(100); } if(LEDSTATE == 1) { //if is pressed digitalWrite(LEDPIN, HIGH); LEDSTATE = 1; } else { //if not pressed digitalWrite(LEDPIN, LOW); LEDSTATE = 0; } }
  4. Hello, i am working with ImageSearch.au3 to find my .bmp image file but it dosent works. -snipped game related content-
×
×
  • Create New...