GY-63_MS5611/libraries/TM1637_RT/examples/TM1637_pchar/TM1637_pchar.ino
2022-10-07 11:32:52 +02:00

45 lines
902 B
C++

//
// FILE: TM1637_pchar.ino
// AUTHOR: Richard Jones
// VERSION: 0.1.0
// PURPOSE: demo TM1637 library
// DATE: 4 October 2022
// URL: https://github.com/radionerd
// Demonstration of how to display char *buff
// Status: Experimental. Tested on STM32F103C8T6 Blue Pill and Arduino Nano only
#include "TM1637.h"
const int DISPLAY_DIGITS_6 = 6;
TM1637 TM;
void setup()
{
Serial.begin(115200);
delay(1000);
Serial.println(__FILE__);
// set clockpin, datapin to your own board pin names
// e.g. myTM.begin(PB8, PB9 , DISPLAY_DIGITS_6 );
TM.begin( 14, 15 , DISPLAY_DIGITS_6 ); // clockpin, datapin, and digits
TM.setBrightness(2);
}
void loop()
{
char buff[20];
static int seconds;
sprintf(buff,"Sec=%02x", seconds++&0xFF );
TM.displayPChar(buff); // send buffer to display
Serial.println(buff); // and serial port.
delay(1000);
}
// -- END OF FILE --