Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Free serial port activex control
#9
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
Code:
Copy      Help
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
Code:
Copy      Help
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


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)