D
D
Dmitry_Fe2017-07-21 11:18:41
Arduino
Dmitry_Fe, 2017-07-21 11:18:41

Arduino, display update when receiving new value from receiver?

Hello, I ran into a problem with an arduino sketch, the code is fully working, when the remote control button is pressed, the arduino receives a value and displays the NV1638, but the problem is that it is necessary to implement the replacement of the value with a new signal.

#include <InvertedTM1638.h>
#include <TM1638.h>
#include <TM1638QYF.h>
#include <TM1640.h>
#include <TM16XX.h>
#include <TM16XXFonts.h>
#include <RemoteReceiver.h>

TM1638 module(8, 9, 10);//8-DIO/9-CLK/10-STB подключам пины
/*
* Demo for RF remote switch receiver.
* For details, see RemoteReceiver.h!
*
* This sketch shows the received signals on the serial port.
* Connect the receiver to digital pin 2.
*/


void setup() {
  Serial.begin(115200);

  
  //Initialize receiver on interrupt 0 (= digital pin 2), calls the callback "showCode"
  //after 3 identical codes have been received in a row. (thus, keep the button pressed
  //for a moment)
  //
  //See the interrupt-parameter of attachInterrupt for possible values (and pins)
  //to connect the receiver.
  RemoteReceiver::init(0, 3, showCode);
}

void loop() { 

}

//Callback function is called only when a valid code is received.
void showCode(unsigned long receivedCode, unsigned int period) {
  //Note: interrupts are disabled. You can re-enable them if needed.

 module.setDisplayToDecNumber( receivedCode,0,false);//выводим на табло значение кнопки

  //Print the received code.
  Serial.print("Code: ");
  Serial.print(receivedCode);
  Serial.print(", period duration: ");
  Serial.print(period);
  Serial.println("us.");
}

Thanks in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
evgeniy_lm, 2017-07-21
@evgeniy_lm

Well, what's the problem?
Display when the signal has changed or display after a certain period of time.

D
Dreambox, 2017-07-21
@IoT

Refresh the screen on a timer.

D
Dmitry_Fe, 2017-07-21
@Dmitry_Fe

it is necessary to implement the replacement of one signal with another, with a constant indication on the screen of the last value

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question