“Matrix.print()”的版本间的差异
(创建页面,内容为“{| style="width: 800px;" |- | <p style="color: #666666;font-size:220%">'''Matrix.print(character)'''</p> <br> <p style="color: #E87E05;font-size:135%">描述</p> 用...”) |
|||
(未显示同一用户的2个中间版本) | |||
第5行: | 第5行: | ||
<br> | <br> | ||
<p style="color: #E87E05;font-size:135%">描述</p> | <p style="color: #E87E05;font-size:135%">描述</p> | ||
− | + | 用来在屏上静态显示字符。print()必须配合<code style="color: #E87E05">setCursor(x,y)</code>函数使用,需要设置坐标。 | |
<br> | <br> | ||
<p style="color: #E87E05;font-size:135%">参数</p> | <p style="color: #E87E05;font-size:135%">参数</p> | ||
第44行: | 第44行: | ||
*彩色点阵:[[Sensor-Dot Matrix-Color/zh]]静态显示数字 | *彩色点阵:[[Sensor-Dot Matrix-Color/zh]]静态显示数字 | ||
<source lang="c++"> | <source lang="c++"> | ||
+ | #include <Microduino_Matrix.h> | ||
+ | uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { //1x1 | ||
+ | {64} //点阵IIC地址 | ||
+ | }; | ||
+ | |||
+ | Matrix display = Matrix(Addr, TYPE_COLOR); //TYPE_COLOR or TYPE_S2 | ||
+ | |||
+ | void setup() { | ||
+ | Wire.begin(); | ||
+ | display.setBrightness(255); | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | // Print | ||
+ | display.setColor(255, 0, 255); | ||
+ | for(int=0; i < 10; i++) | ||
+ | { | ||
+ | display.setCursor(1, 0); //x, y | ||
+ | display.print(i); | ||
+ | delay(500); | ||
+ | } | ||
+ | display.clearDisplay(); | ||
+ | } | ||
</source> | </source> | ||
*彩色点阵:[[Sensor-Dot Matrix-Color/zh]]动态态显示字符串 | *彩色点阵:[[Sensor-Dot Matrix-Color/zh]]动态态显示字符串 | ||
<source lang="c++"> | <source lang="c++"> | ||
+ | #include <Microduino_Matrix.h> | ||
+ | |||
+ | uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { //1x1 | ||
+ | {64} //点阵IIC地址 | ||
+ | }; | ||
+ | |||
+ | Matrix display = Matrix(Addr, TYPE_COLOR); //TYPE_COLOR or TYPE_S2 | ||
+ | void setup() { | ||
+ | Wire.begin(); | ||
+ | display.setBrightness(255); | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | // Print | ||
+ | display.setColor(0, 255, 0); | ||
+ | int i = display.getStringWidth("mCookie!"); | ||
+ | for (int a = display.getWidth() * 8; a > -i - display.getWidth() * 8; a--) { | ||
+ | display.setCursor(a, 0); //x, y | ||
+ | display.print("mCookie!"); | ||
+ | delay(120); | ||
+ | } | ||
+ | display.clearDisplay(); | ||
+ | } | ||
</source> | </source> | ||
− | *单色点阵:[[Sensor-Dot Matrix-S2/zh]] | + | <br> |
+ | *单色点阵:[[Sensor-Dot Matrix-S2/zh]]静态显示字符 | ||
+ | <source lang="c++"> | ||
+ | #include <Microduino_Matrix.h> | ||
+ | |||
+ | uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { //1x1 | ||
+ | {64} //点阵IIC地址 | ||
+ | }; | ||
+ | |||
+ | Matrix display = Matrix(Addr, TYPE_S2); //TYPE_COLOR or TYPE_S2 | ||
+ | |||
+ | void setup() { | ||
+ | Wire.begin(); | ||
+ | display.setBrightness(255); | ||
+ | display.clearDisplay(); | ||
+ | } | ||
+ | void loop() { | ||
+ | // Print | ||
+ | display.setCursor(2, 0); //x, y | ||
+ | display.print("m"); | ||
+ | delay(1000); | ||
+ | display.clearDisplay(); | ||
+ | display.setCursor(2, 0); //x, y | ||
+ | display.print("u"); | ||
+ | delay(1000); | ||
+ | display.clearDisplay(); | ||
+ | } | ||
+ | </source> | ||
+ | *单色点阵:[[Sensor-Dot Matrix-S2/zh]]静态显示数字 | ||
+ | <source lang="c++"> | ||
+ | #include <Microduino_Matrix.h> | ||
+ | |||
+ | uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { //1x1 | ||
+ | {64} //点阵IIC地址 | ||
+ | }; | ||
+ | |||
+ | Matrix display = Matrix(Addr, TYPE_S2); //TYPE_COLOR or TYPE_S2 | ||
+ | |||
+ | void setup() { | ||
+ | Wire.begin(); | ||
+ | display.setBrightness(255); | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | // Print | ||
+ | for(int i=0; i < 10; i++) | ||
+ | { | ||
+ | display.setCursor(1, 0); //x, y | ||
+ | display.print(i); | ||
+ | delay(500); | ||
+ | } | ||
+ | display.clearDisplay(); | ||
+ | } | ||
+ | </source> | ||
+ | *单色点阵:[[Sensor-Dot Matrix-S2/zh]]动态态显示字符串 | ||
+ | <source lang="c++"> | ||
+ | #include <Microduino_Matrix.h> | ||
+ | |||
+ | uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { //1x1 | ||
+ | {64} //点阵IIC地址 | ||
+ | }; | ||
+ | |||
+ | Matrix display = Matrix(Addr, TYPE_S2); //TYPE_COLOR or TYPE_S2 | ||
+ | |||
+ | void setup() { | ||
+ | Wire.begin(); | ||
+ | display.setBrightness(255); | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | // Print | ||
+ | int i = display.getStringWidth("mCookie!"); | ||
+ | for (int a = display.getWidth() * 8; a > -i - display.getWidth() * 8; a--) { | ||
+ | display.setCursor(a, 0); //x, y | ||
+ | display.print("mCookie!"); | ||
+ | delay(120); | ||
+ | } | ||
+ | display.clearDisplay(); | ||
+ | } | ||
</source> | </source> | ||
− | |||
<p style="color: #E87E05;font-size:135%">其他</p> | <p style="color: #E87E05;font-size:135%">其他</p> | ||
− | |||
*[[Matrix.getHeight()|getHeight()]] | *[[Matrix.getHeight()|getHeight()]] | ||
*[[Matrix.getWidth()|getWidth()]] | *[[Matrix.getWidth()|getWidth()]] | ||
+ | *[[Matrix.setBrightness()|setBrightness()]] | ||
*[[Matrix.setLed()|setLed()]] | *[[Matrix.setLed()|setLed()]] | ||
+ | *[[Matrix.clearDisplay()|clearDisplay()]] | ||
*[[Matrix.setColor()|setColor()]] | *[[Matrix.setColor()|setColor()]] | ||
*[[Matrix.drawLine()|drawLine()]] | *[[Matrix.drawLine()|drawLine()]] | ||
第66行: | 第190行: | ||
*[[Matrix.drawRFrame()|drawRFrame()]] | *[[Matrix.drawRFrame()|drawRFrame()]] | ||
*[[Matrix.drawCircle()|drawCircle()]] | *[[Matrix.drawCircle()|drawCircle()]] | ||
− | *[[Matrix.drawDisc()|drawDisc | + | *[[Matrix.drawDisc()|drawDisc()]] |
− | |||
*[[Matrix.writeString()|writeString()]] | *[[Matrix.writeString()|writeString()]] | ||
*[[Matrix.drawBMP()|drawBMP()]] | *[[Matrix.drawBMP()|drawBMP()]] |
2017年7月27日 (四) 04:59的最新版本
Matrix.print(character)
描述 用来在屏上静态显示字符。print()必须配合 参数 character:需要显示的字符,可是字符、字符串、数字。 返回值 无 示例
#include <Microduino_Matrix.h>
uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { //1x1
{64} //点阵IIC地址
};
Matrix display = Matrix(Addr, TYPE_COLOR); //TYPE_COLOR or TYPE_S2
void setup() {
Wire.begin();
display.setBrightness(255);
display.clearDisplay();
}
void loop() {
// Print
display.setColor(0, 255, 0);
display.setCursor(2, 0); //x, y
display.print("m");
delay(1000);
display.clearDisplay();
display.setColor(0, 255, 255);
display.setCursor(2, 0); //x, y
display.print("u");
delay(1000);
display.clearDisplay();
}
#include <Microduino_Matrix.h>
uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { //1x1
{64} //点阵IIC地址
};
Matrix display = Matrix(Addr, TYPE_COLOR); //TYPE_COLOR or TYPE_S2
void setup() {
Wire.begin();
display.setBrightness(255);
}
void loop() {
// Print
display.setColor(255, 0, 255);
for(int=0; i < 10; i++)
{
display.setCursor(1, 0); //x, y
display.print(i);
delay(500);
}
display.clearDisplay();
}
#include <Microduino_Matrix.h>
uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { //1x1
{64} //点阵IIC地址
};
Matrix display = Matrix(Addr, TYPE_COLOR); //TYPE_COLOR or TYPE_S2
void setup() {
Wire.begin();
display.setBrightness(255);
}
void loop() {
// Print
display.setColor(0, 255, 0);
int i = display.getStringWidth("mCookie!");
for (int a = display.getWidth() * 8; a > -i - display.getWidth() * 8; a--) {
display.setCursor(a, 0); //x, y
display.print("mCookie!");
delay(120);
}
display.clearDisplay();
}
#include <Microduino_Matrix.h>
uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { //1x1
{64} //点阵IIC地址
};
Matrix display = Matrix(Addr, TYPE_S2); //TYPE_COLOR or TYPE_S2
void setup() {
Wire.begin();
display.setBrightness(255);
display.clearDisplay();
}
void loop() {
// Print
display.setCursor(2, 0); //x, y
display.print("m");
delay(1000);
display.clearDisplay();
display.setCursor(2, 0); //x, y
display.print("u");
delay(1000);
display.clearDisplay();
}
#include <Microduino_Matrix.h>
uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { //1x1
{64} //点阵IIC地址
};
Matrix display = Matrix(Addr, TYPE_S2); //TYPE_COLOR or TYPE_S2
void setup() {
Wire.begin();
display.setBrightness(255);
}
void loop() {
// Print
for(int i=0; i < 10; i++)
{
display.setCursor(1, 0); //x, y
display.print(i);
delay(500);
}
display.clearDisplay();
}
#include <Microduino_Matrix.h>
uint8_t Addr[MatrixPix_X][MatrixPix_Y] = { //1x1
{64} //点阵IIC地址
};
Matrix display = Matrix(Addr, TYPE_S2); //TYPE_COLOR or TYPE_S2
void setup() {
Wire.begin();
display.setBrightness(255);
}
void loop() {
// Print
int i = display.getStringWidth("mCookie!");
for (int a = display.getWidth() * 8; a > -i - display.getWidth() * 8; a--) {
display.setCursor(a, 0); //x, y
display.print("mCookie!");
delay(120);
}
display.clearDisplay();
}
其他 |