If you fancy a sample or anyone else..you can test this basic code
Between option explicit and randomize
Option Explicit
Dim MSComm1
Set MSComm1 = CreateObject("MSCommLib.MSComm")
MSComm1.CommPort = 4 ' Set the COM port number ARDUINO LAMP BOARD
MSComm1.Settings = "115200,N,8,1" ' Set the baud rate, parity, data bits, and stop bits
MSComm1.PortOpen = True ' Open the serial port
Ok now find in the Sorcerer table script the lines below
Sub LeftSlingShot_Slingshot
PlaySound SoundFX("fx_slingshot", DOFContactors), 0, 1, -0.05, 0.05
LeftSling4.Visible = 1
Lemk.RotX = 26
LStep = 0
vpmTimer.PulseSw 32
LeftSlingShot.TimerEnabled = 1
MSComm1.Output = "1" & vbCrLf ' <--- ADD THIS LINE OF CODE ..HERE IS WHERE YOU CAN SEND A SIMPLE DIGIT "1" TO THE ARDUINO BOARD ON LeftSlingShot HIT
End Sub
This works on 32bit 10.7.. Basically send a command directly from the table to a board that can do almost anything.
I suspect no one has approached sending directly to a board in this way,perhaps it would spark an interest for some members.
//////////////////////////////////////////////////////////////////////////////////////////////
Of course your arduino code would look something like this:
void setup() {
Serial.begin(115200); // initialize serial communication at 115200 baud rate
pinMode(2, OUTPUT); // set pin 2 as output
}
void loop() {
if (Serial.available() > 0) {
char ch = Serial.read();
// ******************* FLASHERS DONT REALLY NEED CODE TO SWITCH THEM OFF BUT WE DO KEEP THEM ALIVE FOR JUST A MOMENT TO AVOID GHOSTING 50MS*************
// 1
if (ch == '1') {
digitalWrite(2, HIGH);
delay(50);
}
else {
digitalWrite(2, LOW);
}
Edited by shinobisan, 08 September 2023 - 06:07 PM.