Skip to main content

Reply to "TMCC Control With Arduino"

Randy P. posted:
Harvy posted:

I don't know anything about Arduino (including how to pronounce it), but I can tell you that I pause 120ms between Horn commands while a user of my software holds down the Horn button.  This works 99.9% of the time.  You are correct that some engines seem to be pickier than others, but from my experience it is not the engine, it is the processor in whatever device is sending the commands.  It is not going to dedicate 100% of its CPU to sending out commands.  All you can hope for is to use trial and error to get it to work the best you can.  In your case you are lucky.  You are working with a finite number of engines.  For me, It is whatever engines my customers happen to have.

As far as wanting your Arduino to be doing other things while you are sending out Horn commands like there is no tomorrow, I use the "Application.DoEvents();" object in C#.  For my software, it allows it to detect the mouse up event so it can break out of the loop when the user releases the button of the mouse to stop sending horn commands.  It also allows you do anything else you want.

Another option for you, since there will be no user as such, is to create a separate thread to handle just the string of Horn commands.  That way your code can go on and do whatever you want.  If you don't understand the concept of threads, please let me know and I will explain it.

Here is my code for the Horn.  This does not include the Legacy variable horn.  That is separate code.

Let me know if you need me to explain this code more.  It is in C#.

 

Harvy. thanks for the info. Unfortunately I can’t see the C# code you posted. I see the screen shot in your following post, but nothing for this one. Can anyone else see it?

Randy

Sorry.  It was there before.  Hopefully you can see this:

Attachments

Images (1)
  • mceclip0
Last edited by Harvy

OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

×
×
×
×
×