DISCO-F746NG_LCD_3.ZIP

  • 浏览量:565
  • 下载量:3
  • 资料大小:1.1 MB
  • 日期:2015-11-30
  • 上传者:shaoziyang
  • 分享
  • 评论
  • 举报
  • 收藏

资料描述

    这个例子中,绘制首尾相接的直线。同时,可以按下反面的蓝色按钮清屏。





    #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;
    }
    }
评论(0)

登录后可评论,请 登录注册

   
相关资料
换一换