By steven.mcneese
I have an Arduino Leonardo I am using for development on a Windows machine to simulate the Arduino dfrobot-processor built into the LattePanda. I am using the following code to initialize the arduino and configure pin 4 to be used with a relay board.
Code: Select all
                arduino = new Arduino(settings.comPort);
                arduino.pinMode(4, Arduino.OUTPUT);
                arduino.digitalPinUpdated += arduino_digitalPinUpdated;
                arduino.digitalWrite(4, Arduino.HIGH);
When the arduino.digitalWrite(4, Arduino.HIGH) is called, the event procedure ardion_digitalPinUpdated is not called. No matter what I do, I cannot get this event to fire. I need to be able to track the state of the pin changing.

Anyone have any suggestions on what I am doing wrong or what may be happening?
Thanks for your support.
It seems like that you does not use Arduino language, which language are you using to code now?
And please offer the whole test program and code for our reference.
So the problem I am trying to solve is that when I do a digitalWrite(4, Arduino.HIGH) in my C# application, the pin does not always go high. For development and testing, I have an Arduino LEONARDO connected via USB to my Windows development machine. Occasionally when I try to set the pin high, I can see received data LED flicker slightly and the pin I am setting is supposed to trigger a relay on a relay board and the relay input LED flashes slightly but the relay does not latch. As a workaround (which shouldn't be needed), I had to do 3 digitalWrite(4, Arduino.HIGH) statements with a 200 ms delay between each to consistently latch my relay when needed.