Hi
Found an Arduino in my shed, put a primitive sketch on it that listens for commands "fast", "med" and "slow" on the serial port then flashes its on board LED accordingly, then wrote a little QB64 program to send commands via serial port.
As proof of concept it works.
Arduino sketch.
String inputString ="";
int fspeed = 500;
char code = "x";
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
//Serial.println(code);
digitalWrite(LED_BUILTIN, HIGH);
delay(fspeed);
digitalWrite(LED_BUILTIN,LOW);
delay(fspeed);
}
void serialEvent()
{
while(Serial.available())
{
char ch = (char)Serial.read();
Serial.write(ch);
inputString += ch;
if(ch == '\n')
{
if(inputString == "fast\r\n"){
fspeed = 50;
code = "s";
}
if(inputString == "slow\r\n"){
fspeed = 1000;
code ="f";
}
if(inputString == "med\r\n"){
fspeed = 500;
code ="f";
}
inputString ="";
}
}
}
currMode = ""
comPno = "COM3:"
comPmode = "9600,N,8,1,ASC"
CreateButtons
DisplayButtons
' If the mouse was clicked check if it was selecting a tile, clicking a button or putting a tile on the map
currMode = CheckButtons
si = 0
_Dest speedBtn
(si
).imageH
speedBtn(si).x = 10
speedBtn(si).y = 10
speedBtn(si).w = 64
speedBtn(si).h = 32
speedBtn(si).code = "slow"
si = 1
_Dest speedBtn
(si
).imageH
speedBtn(si).x = 110
speedBtn(si).y = 10
speedBtn(si).w = 64
speedBtn(si).h = 32
speedBtn(si).code = "med"
si = 2
_Dest speedBtn
(si
).imageH
speedBtn(si).x = 210
speedBtn(si).y = 10
speedBtn(si).w = 64
speedBtn(si).h = 32
speedBtn(si).code = "fast"
_PutImage (speedBtn
(si
).x
, speedBtn
(si
).y
), speedBtn
(si
).imageH
CheckButtons = ""
If RectCollide
(mousePos.x
, mousePos.y
, 1, 1, speedBtn
(si
).x
, speedBtn
(si
).y
, speedBtn
(si
).w
, speedBtn
(si
).h
) Then CheckButtons = speedBtn(si).code
rect1X2 = rect1X + rect1Width - 1
rect1Y2 = rect1Y + rect1Height - 1
rect2X2 = rect2X + rect2Width - 1
rect2Y2 = rect2Y + rect2Height - 1
RectCollide = 0
RectCollide = -1