11-21-2021, 05:04 PM
Got things working at a very basic level. One thing I don't know how to do that I would love some help with is determining which port the Arduino is assigned when plugged in. Usually it's port 3...but it changes. Another is how to better implement NetComm.InputData. Right now I just wait a second to receive the reply from the Arduino.
Function sendToArduino
Function ArdunioINO
Function sendToArduino
NETCommOCX.NETComm x._create
BSTR SETTINGS="9600"
VARIANT d="0" ;;0 will trun on TXLED, 1 will turn off TXLED
x.CommPort=3
x.Settings=SETTINGS
x.PortOpen=TRUE
x.Output=d
1
out x.InputData
Function ArdunioINO
int x = 0;
void setup() {Serial.begin(9600);}
void loop() {
,if (Serial.available() > 0) {
,,x = Serial.readString().toInt();
,,switch (x) {
,,,case 0:Serial.print("00");delay(100);TXLED0;break;
,,,case 1:Serial.print("01");delay(100);TXLED1;break;
,,}
,}
}
///NOTE: THIS IS ARDUNIO CODE, NOT QM