I currently have a program where it will open an executable file upon an event happening, in this case, I want to switch LED animations. I am using the library FastLED for this.
The process is the executable/batch file opens, sends a int value to the arduino, then arduino will select the animation based on the int value received. So functionally, the LED strip should hold the last value received and play that animation until another value is received.
This is the code I am currently using, although it works fine using the serial monitor, it has problems when receiving from other sources. (This is only the important bit.) For this test, I am using two variables, 1 and 2. 1 will cause a rainbow to appear on the LED strip, while 2 will cause it to go black.
if (Serial.available() > 0) {
inByte = Serial.read();
}
switch (inByte){
case '1':
fill_rainbow( leds, NUM_LEDS, gHue, 7);
break;
case '2':
leds[0] = CRGB::Black;
break;
}
}
The best, and most simple way (or so it appears) is currently by using a batch file on command prompt that does the following, sending to COM3, the port the adrunio is on.
echo 1 > COM3
However, this does not work. It will successfully send, but the LED strip turns off completely and only plays the first frame of the animation. Other methods I tried were using macro terminals, such as teraterm, which worked when using the terminal, but the macro didn’t.
So, a few questions:
Is there an easy way to get an executable/batch to do a key then send it to the adruino, and hold the value? Is it a problem with my code? Reminder, it works with the serial monitor, but does not with other sources.
Secondly, it is also possible for me to use IPC protocol (CLP, named or pipe), but I have not found any programs that would accept the IPC protocol and then send the correct byte to serial.
Thirdly, although I seriously doubt it, could anybody provide a teraterm macro that would connect to a COM3 then send a simple byte?
That’s all, thanks. I am open to any other suggestions. As long as it is an EXE, BATCH or allows IPC protocol, it will work.