I made a simple tach using a servo, I am trying to only send the PRM from simhub to arduino. Following the wiki, I have added this to the custom protocol box
format([DataCorePlugin.GameData.NewData.Rpms],'0') + ';'
and then opened the arduino setup tool -> file -> open in arduino, and change over the the SHCustomProtocol.h and have added these two lines
int rpm = FlowSerialReadStringUntil(';').toInt(); FlowSerialDebugPrintLn("RPM : " + String(rpm));
I have both uploaded from the arduino ide itself and made sure the file was saved and used the simhub flasher.
yet I see no output in simhub under the arduino(I assume it should show it the lighter grey box underneath the two checkboxes), when I am replaying the replay to test. But if I open the custom protocol I can see the value is pulling from the replay and formatted as such 1000; for example.
Any help would be appreciated, I am pretty fimiliar with arduinos as well, if it matters I am using an Arduino nano.
** I forgot to mention that i also tried jus the default example in there to just display the message, and also see nothing. As well as updated simhub to 7.04.2
Hi ! The message is automatically terminated by "\n" : https://github.com/SHWotever/SimHub/wiki/Custom-Arduino-hardware-support#message-format
But you have to read the whole message (otherwise it will cause sync issues and disconnect) so if you only have a single variable to use you can bypass the separator and only rely on \n:
format([DataCorePlugin.GameData.NewData.Rpms],'0')
int rpm = FlowSerialReadStringUntil('\n').toInt(); FlowSerialDebugPrintLn("RPM : " + String(rpm));
I updated it, but still getting same results. I added a screen shot, of where i can see it but not seeing the serial output message back to simhub. THe replay is looping this whole time.
Ok so progress, but the issue still persist, I decided to add the code I needed to run the tach, which is just the servo library. It compiled fine, so I then added a map from the rpm to the angles for the servo. And its working, but the serial output still isnt displaying which would be nice for debugging.