LattePandaGeneral

Digital Pin Updated Event Not Firing

userHead steven.mcneese 2019-05-24 03:41:45 7776 Views4 Replies
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.wireBegin(200);
                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?
2019-05-31 21:15:11 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. userHeadPic steven.mcneese
2019-05-31 01:16:34 The arduino coprocessor is running the standardfirmata sketch. The code above is C#. userHeadPic steven.mcneese