NNGB Posted August 31, 2021 Posted August 31, 2021 I want to stop the operation of OLED and LED in 'no data yet' state. I wrote a code using if and null in Arduino, but it did not work, and OLED and LED continue to express the last data value. What IF statement can Arduino determine when the output data of DCS-BIOS is 'no data yet'?
Sprocket1597 Posted November 19, 2021 Posted November 19, 2021 Here is how I did it: void loop() { DcsBios::loop(); //watchdog timer... clears displays when MetadataEnd/_UPDATE_COUNTER stops changing for more than 2 seconds unsigned long currentMillis = millis(); if (currentMillis - previousMillis >= interval) { previousMillis = currentMillis; if (ticklast == tick) { lc.clearDisplay(0); lc.clearDisplay(1); } tick=ticklast; } } //end loop void onUpdateCounterChange(unsigned int newValue) { tick=newValue; } DcsBios::IntegerBuffer UpdateCounterBuffer(0xfffe, 0x00ff, 0, onUpdateCounterChange);
Recommended Posts