查看Noduino OLED的源代码
←
Noduino OLED
跳转到:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
== 概述 == SSD1306 驱动芯片 OLED 屏, I2C 接口 <br><br> == 开发环境准备 == 根据您的系统,选择如下快速指南: * [[Getting Started with Noduino SDK on Linux]] * [[Getting Started with Noduino SDK on Mac OS X]] * [[Getting Started with Noduino SDK on Windows]] <br><br> == 硬件准备 == 此传感器为 I2C 接口,Falcon 接线方式如下: * Sensor_SCL --> Noduino_Falcon_D9 * Sensor_SDA --> Noduino_Falcon_D8 * Sensor_3V3 --> Noduino_Falcon_3V3 * Sensor_GND --> Noduino_Falcon_GND NodeC / SmartNode 接线方式如下: * Sensor_SCL --> SmartNode_IO5 * Sensor_SDA --> SmartNode_IO4 * Sensor_3V3 --> SmartNode_3V3 * Sensor_GND --> SmartNode_GND <br><br> == 编译烧写 == 进入你的 u8glib/HelloWorld/ 目录: <source lang=bash> $ cd /PATH/TO/noduino-sdk/examples/noduino/u8glib/HelloWorld/ </source> 编译、上传一步完成: <source lang=bash> $ make flash </source> 不同平台下,你的串口设备号可能不一样,确认一下你的串口设备,Linux 下 Falcon 开发板可能被识别为 /dev/ttyUSB1(dmesg 查看),则: <source lang=bash> $ make flash ESPPORT=/dev/ttyUSB1 </source> Windows 下 Falcon 开发板可能被识别为 COM6(控制面板 --> 设备管理器里查看),则: <source lang=bash> $ make flash ESPPORT=COM6 </source> <br><br> == 查看结果 == 上传完之后,用串口工具,用 115200 的波特率打开串口,即可看到串口在持续输出传感器测得的值: Windows 下可用串口调试助手这类插看 Linux 下推荐使用 picocom: <source lang=bash> $ sudo apt-get install picocom $ picocom -b 115200 /dev/ttyUSB1 picocom v1.7 port is : /dev/ttyUSB2 flowcontrol : none baudrate is : 115200 parity is : none databits are : 8 escape is : C-a local echo is : no noinit is : no noreset is : no nolock is : no send_cmd is : sz -vv receive_cmd is : rz -vv imap is : omap is : emap is : crcrlf,delbs, Terminal ready ...... ...... </source> Ctrl + a q 退出 picocom <br><br> == 代码示例 == <source lang=cpp> #include "noduino.h" #include "compile.h" #include "U8glib.h" U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI irom void draw(void) { u8g.setFont(u8g_font_unifont); u8g.drawStr(0, 22, "Hello World!"); } irom void setup(void) { // assign default color value if (u8g.getMode() == U8G_MODE_R3G3B2) { u8g.setColorIndex(255); // white } else if (u8g.getMode() == U8G_MODE_GRAY2BIT) { u8g.setColorIndex(3); // max intensity } else if (u8g.getMode() == U8G_MODE_BW) { u8g.setColorIndex(1); // pixel on } else if (u8g.getMode() == U8G_MODE_HICOLOR) { u8g.setHiColorByRGB(255, 255, 255); } serial_begin(115200); serial_printf("%s\r\n", UTS_VERSION); } void loop(void) { // picture loop u8g.firstPage(); do { draw(); } while (u8g.nextPage()); draw(); // rebuild the picture after some delay delay(50); } </source> 更多参考示例位于:noduino-sdk/blob/master/examples/noduino/u8glib/ 下,有显示 Logo、位图、缩放、旋转、动画。。。 <br><br> == 扩展阅读 == ;;更多问题参考: * [[Noduino]] <br><br> <br><br> <br><br>
返回到
Noduino OLED
。
个人工具
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
社区专页
新闻动态
最近更改
随机页面
帮助
工具箱
链入页面
相关更改
特殊页面