查看: 1367|回复: 0

【赚周年币】技术贴Week 2-Day3-----mbed之资源搜索

[复制链接]
  • TA的每日心情
    奋斗
    2020-5-27 15:41
  • 签到天数: 868 天

    连续签到: 1 天

    [LV.10]以坛为家III

    发表于 2017-1-7 14:11:36 | 显示全部楼层 |阅读模式
    分享到:
    本帖最后由 wambob 于 2017-1-7 14:26 编辑

             mbed上有很多爱好者发布的资源,可以通过搜索来查找感兴趣的资源。
    oled 128x64液晶模块比较常见的。比如控制器为ssd1306的单色显示器。
    1.JPG

    选择一个适合的导入到你的mbed程序。
    2.JPG
    导入mbed后,有时候需要修改
    3.JPG

    4.JPG
    主程序
    1. #include "mbed.h"
    2. #include "Adafruit_SSD1306.h"
    3. #define SPI_CLK     P0_24
    4. #define SPI_MOSI    P0_26
    5. #define SPI_MISO    P0_25
    6. #define SPI_CS      P0_15
    7. #define DC          P0_27
    8. #define RST         P0_13
    9. DigitalOut myled(P0_28);
    10. Adafruit_SSD1306_SPI display(SPI_MOSI, SPI_CLK, SPI_CS, DC, RST, 64, 128);
    11. int main() {   
    12.     display.splash();
    13.     wait(3.0);
    14.     display.clearDisplay();   
    15.     display.printf("%ux%u OLED Display\r\n", display.width(), display.height());
    16.     display.printf("https://www.cirmall.com\r\n");   
    17.     while(1)
    18.     {
    19.         myled = !myled;
    20.        display.drawChar(10,20,'E',1,0,2);
    21.         display.drawChar(25,20,'E',1,0,2);
    22.         display.drawChar(40,20,'b',1,0,2);
    23.         display.drawChar(55,20,'o',1,0,2);
    24.         display.drawChar(70,20,'a',1,0,2);
    25.         display.drawChar(85,20,'r',1,0,2);
    26.         display.drawChar(100,20,'d',1,0,2);
    27.         display.display();
    28.         wait(0.5);
    29.         
    30.     }
    31. }
    复制代码
    编译后下载,按板上的复位键后:
    6.JPG

    评分

    参与人数 2 +38 收起 理由
    EEboard爱板网 + 18 3周发帖养成记 奖励
    loveeeboard + 20

    查看全部评分

    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /2 下一条



    手机版|小黑屋|与非网

    GMT+8, 2024-4-27 06:40 , Processed in 0.139054 second(s), 20 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.