| Glcd.h | |
|---|---|
#ifndef GLCD_H
#define GLCD_H
#include "mbed.h"
class Glcd
{
public:
Glcd();
Glcd(PinName tx, PinName rx);
void clearAll();
void draw(int x, int y, unsigned char dt[], int n);
void clear(int x, int y, int n);
void drawChar(int x, int y, unsigned char ch);
void print(int x, int y, char *str);
void plotXY(int x, int y, int on_off);
protected:
Serial *GLCD; // tx, rx
private:
};
#endif // GLCD_H
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 座標に点を打つ/消す 16 17 18 19 20 21 |
| Glcd.cpp | |
|---|---|
void Glcd::plotXY(int x, int y, int on_off)
{
GLCD->putc(3);
GLCD->putc(x);
GLCD->putc(y);
GLCD->putc(on_off);
GLCD->getc();
}
|
1 on=1, off=0 2 x(0~127), y(0~63)。他のメソッドとはyの概念が異なることに注意 3 plotXYコマンド 4 5 6 7 8 |
| checkPlot | |
|---|---|
void BreakOut::checkPlot()
{
for(int x=0; x<64; x++)
plotXY(x,x,1);
wait(1.0);
for(int x=0; x<64; x++)
plotXY(x,x,0);
}
|
1 2 3 右上から中央下まで点を打つ 4 5 一秒後に 6 上で打った点を消す 7 8 |
