电子工程师技术服务社区
- 社区首页
- 下载
- DISCO-F746NG_LCD_3.ZIP
资料描述
这个例子中,绘制首尾相接的直线。同时,可以按下反面的蓝色按钮清屏。
#include "mbed.h"
#include "lcd_disco_f746ng.h"
#define width 480
#define height 272
digitalout led1(led1);
digitalin button(pi_11);
lcd_disco_f746ng lcd;
uint16_t x1, y1, x2, y2;
int main()
{
led1 = 1;
x1 = rand()%width;
y1 = rand()%height;
x2 = rand()%width;
y2 = rand()%height;
while(1)
{
lcd.settextcolor(rand());
lcd.drawline(x1, y1, x2, y2);
x1 = x2;
y1 = y2;
x2 = rand()%width;
y2 = rand()%height;
if(button == 1)
{
lcd.clear(0);
}
wait(0.1);
led1 = !led1;
}
}