LoginSignup
0
0

ArduinoUnoR4WiFi: LEDマトリックスにカウントを表示

Last updated at Posted at 2024-05-12

ArduinoR4WiFi_may1202.jpg

プログラム

display_count.ino
// ---------------------------------------------------------------------
/*
	display_count.ino

					May/12/2024

*/
// ---------------------------------------------------------------------
// To use ArduinoGraphics APIs, please include BEFORE Arduino_LED_Matrix
#include "ArduinoGraphics.h"
#include "Arduino_LED_Matrix.h"

ArduinoLEDMatrix matrix;

int icount = 0;

// ---------------------------------------------------------------------
void setup() {
	Serial.begin(115200);
	matrix.begin();

	matrix.beginDraw();
	matrix.stroke(0xFFFFFFFF);
	// add some static text
	// will only show "UNO" (not enough space on the display)

	const char text[] = "UNO r4";
	matrix.textFont(Font_4x6);
	matrix.beginText(0, 1, 0xFFFFFF);
	matrix.println(text);
	matrix.endText();

	matrix.endDraw();

	delay(2000);
}

// ---------------------------------------------------------------------
void loop()
{
	display_proc(icount);
	delay(1000);
	icount++;
}

// ---------------------------------------------------------------------
void display_proc(int icount)
{
	char text_in[10] = "";
	sprintf(text_in,"%03d",icount);
	matrix.beginDraw();
	matrix.stroke(0xFFFFFFFF);
	matrix.textFont(Font_4x6);
	matrix.beginText(0, 1, 0xFFFFFF);
	matrix.println(text_in);
	matrix.endText();

	matrix.endDraw();
}

// ---------------------------------------------------------------------
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0