Microsoft Word 八月第二篇V4

Similar documents
Microsoft Word 一月第一篇V3

Microsoft Word 十一月第二篇V3

Microsoft Word WIFI第一步V3

Microsoft Word 二月第一篇V4

Microsoft Word 八月第一篇V3

epub83-1

1.ai

Microsoft Word 七月第二篇V3

Microsoft Word 十月第一篇V5

Chn 116 Neh.d.01.nis

AN INTRODUCTION TO PHYSICAL COMPUTING USING ARDUINO, GRASSHOPPER, AND FIREFLY (CHINESE EDITION ) INTERACTIVE PROTOTYPING

AL-M200 Series

<4D F736F F D20B942A5CE E4F20A441A4D3BAF4B8F4C258A552AA4FABD8A5DFA5CEA4E1BADDA475A8E3B57BA6A128A55AA55829>

Logitech Wireless Combo MK45 English

ICD ICD ICD ICD ICD

目 录

1. 請 先 檢 查 包 裝 內 容 物 AC750 多 模 式 無 線 分 享 器 安 裝 指 南 安 裝 指 南 CD 光 碟 BR-6208AC 電 源 供 應 器 網 路 線 2. 將 設 備 接 上 電 源, 即 可 使 用 智 慧 型 無 線 裝 置 進 行 設 定 A. 接 上 電 源

Guide to Install SATA Hard Disks

- June 意 味 上 梁 不 正 下 梁 歪 地 动 辄 失 去 理 性 而 对 部 下 狂 吠 给 我 滚, 毛 也 曾 因 被 吵 醒 而 对 哨 兵 猛 吼 老 子 揍 你! 并 罚 站 254) 和 大 红 灯 笼 高 高 挂 成 叠 影 的 一 是 太 太 被 老 爷 惯 坏 而 任

Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLO

CC213

User ID 150 Password - User ID 150 Password Mon- Cam-- Invalid Terminal Mode No User Terminal Mode No User Mon- Cam-- 2

PowerPoint Presentation

an153f

K7VT2_QIG_v3

ansoft_setup21.doc

<4D F736F F D20D4D3D6BECEC4B8E5C4A3B0E52E646F63>

untitled

Windows XP

TX-NR3030_BAS_Cs_ indd

<4D F736F F D20A670A6F3A8CFA5CE4C696E6B ABD8A5DFB4BCBC7AB7C5ABD7BACAB1B1A5ADA578A15DA457A15E28A55AA55829>

68369 (ppp quickstart guide)

中文手册


錄...1 說...2 說 說...5 六 率 POST PAY PREPAY DEPOSIT 更

Microsoft Word - template.doc

7


USB解决方案.ppt

83.indd

开眼看世界

1692_UG.book

編 者 的 話 理 財 的 概 念 要 從 小 培 養 還 記 得 小 時 候, 一 個 香 腸 包 賣 多 少 錢 嗎? 3 元? 4 元? 5 元? 現 在 又 需 要 幾 多 錢 才 可 買 一 個 呢? 6 元? 8 元? 10 元? 十 年 後 又 賣 多 少 錢?( 大 概 20 元 有

穨control.PDF

Learning Java

Microsoft Word - 实验34.doc

Microsoft Word - CX VMCO 3 easy step v1.doc

(Load Project) (Save Project) (OffLine Mode) (Help) Intel Hex Motor

Applied Biosystems StepOne™ Real-Time PCR System Quick Reference Card for Installation

Microsoft Word - 办事指南汇总 (140x203mm).doc

Microsoft PowerPoint - AWOL - Acrobat Windows Outlook.ppt [Compatibility Mode]

WFC40810


JLX

untitled

WinMDI 28

CX_300 Manual.book

Bus Hound 5

LK110_ck

Microsoft Word - LP doc

!"#!$ %!$"" %%$&&''!(!)!*+,,!%*& -./ *##)' * %$" ',!*+/!*+ / - 0,1 #$*#2 #$*#2'' *($#3 *($#3'' -. 45,67!&$#6)*$ , ' 189

wedding calendar

untitled

WVT new

TPM BIOS Infineon TPM Smart TPM Infineon TPM Smart TPM TPM Smart TPM TPM Advanced Mode...8

桌上型個人電腦採購規格說明表

目录

51 C 51 isp 10 C PCB C C C C KEIL

untitled

untitled

Microsoft Word - Book9

電腦設備LP 第七組顯示卡規範書

2 12

:5-6

IP505SM_manual_cn.doc

Edge-Triggered Rising Edge-Triggered ( Falling Edge-Triggered ( Unit 11 Latches and Flip-Flops 3 Timing for D Flip-Flop (Falling-Edge Trigger) Unit 11

!!

Cadence SPB 15.2 VOICE Cadence SPB 15.2 PC Cadence 3 (1) CD1 1of 2 (2) CD2 2of 2 (3) CD3 Concept HDL 1of 1

LSC操作说明

PCM-3386用户手册.doc

<B2C4A451A454A9A1A578A55FA4E5BEC7BCFAA740AB7EB6B02DA5FEA4E52E706466>

何 日 生 : 西 方 新 聞 媒 體 強 調 價 值 中 立, 這 是 存 在 幾 個 迷 思 的, 首 先 是 強 調 例 外, 例 如 人 咬 狗 才 是 新 聞 ; 其 次 是 懷 疑 和 批 判, 正 如 同 西 方 常 說 的, If your mother says she loves

電腦設備LP _第七組顯示卡規範書

桌上型個人電腦採購規格說明表

恩 典 课 堂 教 学 概 览 课 堂 环 节 持 续 时 间 活 动 所 需 材 料 1 欢 迎 持 续 在 门 口 欢 迎 学 生, 聆 听 他 们 分 享 本 周 开 心 或 烦 恼 的 事 预 备 活 动 <10 分 钟 A 猜 猜 是 谁 B 上 帝 的 礼 物 无 孩 子 们 的 儿 时

团 契 就 体 力 来 说, 参 孙 乃 是 地 上 极 强 壮 的 人 ; 但 在 自 制 忠 贞 和 坚 稳 上, 他 却 是 人 间 最 软 弱 的 了 先 祖 与 先 知 第 页 教 室 布 置 见 第 一 课 课 堂 教 学 概 览 课 堂 环 节 持 续 时 间 活 动

EK-STM32F

Serial ATA ( Nvidia nforce430)...2 (1) SATA... 2 (2) B I O S S A T A... 3 (3) RAID BIOS RAID... 6 (4) S A T A... 9 (5) S A T A (6) Microsoft Win

12232A LED LED LED EL EL CCFL EL CCF

(陈其工、凌有铸)安徽省高等学校质量工程项目进展报告 自动化专业教学团队.doc

9 什 么 是 竞 争 与 冒 险 现 象? 怎 样 判 断? 如 何 消 除?( 汉 王 笔 试 ) 在 组 合 逻 辑 中, 由 于 门 的 输 入 信 号 通 路 中 经 过 了 不 同 的 延 时, 导 致 到 达 该 门 的 时 间 不 一 致 叫 竞 争 产 生 毛 刺 叫 冒 险 如

128 ( ) ( ) [ 1 ] [2] [3] (1) (2) (3) [1] [2] [3] 10 2 ( ) (1997.6) ( ) 64

Serial ATA ( nvidia nforce4 Ultra/SLI)...2 (1) SATA... 2 (2) B I O S S A T A... 3 (3) RAID BIOS RAID... 6 (4) S A T A... 9 (5) S A T A (6) Micro

els0xu_zh_nf_v8.book Page Wednesday, June, 009 9:5 AM ELS-0/0C.8

<4D F736F F D20A7EBBCD0B6B7AABEAAFEA5F3322D3935A67EB2C432A6B8B2C433B2D5C5E3A5DCA564B357BD64AED12E646F63>

BC04 Module_antenna__ doc

桌上型個人電腦採購規格說明表

高中英文科教師甄試心得

SHIMPO_表1-表4

Transcription:

物聯網系列 : 單色圖形顯示介紹 (NOKIA 5110 LCD 開發篇 ) 2016 年 8 月 15 日八月, 2016 文 \ 曹永忠 本篇是接續上篇文章 物聯網系列 : 單色圖形顯示介紹 (NOKIA 5110 LCD 基本篇 ), 已經可以讓 Nokia 5110 LCD 模組顯示字形 ( 曹永忠, 2016d), 畫出基本的幾何圖形, 甚至是簡單的動畫, 但是這些例子並不容易, 所以本文要教讀者如何顯示文字 如何放大文字 畫出幾合圖形, 對一般讀者仍不太容易理解 所以本文告訴讀者, 如何使用 Nokia 5110 LCD 模組的函式庫, 來顯示字形, 如何放大文字 顯示圖片, 甚至簡單的動畫等等即為本文開發篇的主要內容 模組電路組立 NOKIA 5110 是一款基於圖形顯示的 LCD 螢幕 ( 如下圖所示 ), 主要這款螢幕, 被手機大廠 NOKIA 用來裝置在 5110 系列手機, 因而大受歡迎並且有很多的應用 Nokia 5110 LCD 使用的 PCD8544 控制器,NOKIA 3110 用的也是這款控制器, PCD8554 是一款低功耗的 CMOS LCD 控制器, 用於驅動 48 行 84 列的圖形顯示, 並且採用串列匯流排界面與微控制器相連, 大大減少了週邊控制線的數量, 在使用時十分的方便, 而且相對於 LCD1602 LCD12864 都有著自己的獨特優勢

圖 1 Nokia 5110 LCD 模組 在 Arduino 官網 :http://playground.arduino.cc/code/pcd8544, 也有介介紹 Nokia 5110 LCD 模組, 讀者者可以參考考下表之腳位位說明, 進進行電路組立 Nokia 5110 接腳 VCC GND SCE/CE RST/Reset D/C DN/MOSI SCLK LED 表 1 Nokia 5110 LCD 接腳說明 5V( 正 ) 接地晶片致能晶片重置 Data/Comma and select 資料 / 命令選選擇 Serial Data Out 資料輸出 Serial Clockk Out 脈波控制輸輸出被光電源 LCD 模組接接腳表開發版腳位 +5C GND D7 D6 D5 D4 D3 用途供電 ( 正 ) 供電 ( 接地 ) 數位腳位 7 數位腳位 6 數位腳位 5 數位腳位 4 數位腳位 3 +3.3V 3.3V 供電 ( 正 )

Nokia 5110 LCD 開發版 顯示文字 首先, 我們要教讀者者在 Nokia 5110 LCD 模組顯示文文字, 首先先我們依上面面電路組組立將 Nokia 5110 LCD 模組與開開發版連接接完成, 再進進行程式寫寫作 本程式需需要用到兩個個函式庫 ( 曹永忠, 2016e), 關於 Adafruit_PCD8544.h, 請到到網址 : https://github.com/brucetsao/lib_for_mcu/tree/master/arduino_lib/libraries/adafr uit-pcd8544-nokia-5110 或 https://learn.adafruit.com/nokia-5110-3310-monochrome-lcd/graphics-library 或 https://github.com/adafruit/adafruit-pcd8544-nokia-5110-lcd-library, 進行下載,

關於 Adafruit_GFX.h, 請到網址 : https://github.com/brucetsao/lib_for_mcu/tree/master/arduino_lib/libr aries/adafruit_gfx, 進行下載 我們, 請讀者鍵入 Sketch IDE 軟體 ( 軟體下載請到 : https://www.arduino.cc/en/main/software), 編譯完成後上傳到開發版進行測試 表 2 Nokia 5110 LCD 模組文字測試程式一 Nokia 5110 LCD 模組文字測試程式一 (NOKIA_Text_Show) /******************************************************************** * This is an example sketch for our Monochrome Nokia 5110 LCD Displays Pick one up today in the adafruit shop! ------> http://www.adafruit.com/products/338 These displays use SPI to communicate, 4 or 5 pins are required to interface Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above, and the splash screen must be included in any redistribution ********************************************************************* / #include <SPI.h> #include <Adafruit_GFX.h> #include <Adafruit_PCD8544.h> #define PIN_SCE 7 #define PIN_RESET 6

#define PIN_DC 5 #define PIN_SDIN 4 #define PIN_SCLK 3 // Software SPI (slower updates, more flexible pin options): //=== old version pin out====== // pin 7 - Serial clock out (SCLK) // pin 6 - Serial data out (DIN) // pin 5 - Data/Command select (D/C) // pin 4 - LCD chip select (CS) // pin 3 - LCD reset (RST) Adafruit_PCD8544 display = Adafruit_PCD8544(PIN_SCLK, PIN_SDIN, PIN_DC, PIN_SCE, PIN_RESET); // Adafruit_PCD8544 display = Adafruit_PCD8544(SCLK, DIN, D/C, CS/SCE, RST); #define NUMFLAKES 10 #define XPOS 0 #define YPOS 1 #define DELTAY 2 void setup() { // put your setup code here, to run once: Serial.begin(9600); display.begin(); // init done //init Nokia 5110 display // you can change the contrast around to adapt the display // for the best viewing! display.setcontrast(50); //set Contrast display.cleardisplay(); // 清除螢幕 display.display(); // show splashscreen // display.settextsize(1); // 設定字形大小 display.settextcolor(black); // 設定字形顏色黑色 display.setcursor(0,0); // 位置歸零

display.println("hello, world!"); // 印出字 display.settextcolor(white, BLACK); // 反白文字 display.println(3.141592); // 印出字 display.settextsize(2); // 設定字形大小 display.settextcolor(black); // 設定字形顏色黑色 display.print("0x"); display.println(0xdeadbeef, HEX); // 印出字 display.display(); // 顯示所有上面內容, 必要在所有秀字命令後, 一定要的 delay(2000); void loop() { // put your main code here, to run repeatedly: 程式下載網址 : https://github.com/brucetsao/makerdiwo/tree/master/201608 如下圖所示, 我們可以看到 Nokia 5110 LCD 模組資訊顯示出來文字 ( 曹永忠, 2016a, 2016b, 2016c, 2016d; 曹永忠, 許智誠, & 蔡英德, 2015a, 2015b, 2015c, 2015d, 2015e, 2015f; 曹永忠, 許碩芳, 許智誠, & 蔡英德, 2015a, 2015b)

圖 2 Nokia 5110 LCD 模組文字測試程式一結果畫面 顯示點幾何圖形 首先, 我們要教讀者在 Nokia 5110 LCD 模組畫出許多點, 首先我們依上面電路組立將 Nokia 5110 LCD 模組與開發版連接完成, 再進行程式寫作 本程式需要用到兩個函式庫 ( 曹永忠, 2016e), 關於 Adafruit_PCD8544.h, 請到網址 : https://github.com/brucetsao/lib_for_mcu/tree/master/arduino_lib/libraries/adafr uit-pcd8544-nokia-5110 或 https://learn.adafruit.com/nokia-5110-3310-monochrome-lcd/graphics-library 或 https://github.com/adafruit/adafruit-pcd8544-nokia-5110-lcd-library, 進行下載, 關於 Adafruit_GFX.h, 請到網址 : https://github.com/brucetsao/lib_for_mcu/tree/master/arduino_lib/libr aries/adafruit_gfx, 進行下載 我們, 請讀者鍵入 Sketch IDE 軟體 ( 軟體下載請到 : https://www.arduino.cc/en/main/software), 編譯完成後上傳到開發版進行測

試 表 3 Nokia 5110 LCD 模組畫點測試程式一 N Nokia 5110 LCD 模組畫點測試程式一 (NOKIA_drawpixel) /******************************************************************** * This is an example sketch for our Monochrome Nokia 5110 LCD Displays Pick one up today in the adafruit shop! ------> http://www.adafruit.com/products/338 These displays use SPI to communicate, 4 or 5 pins are required to interface Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above, and the splash screen must be included in any redistribution ********************************************************************* / #include <SPI.h> #include <Adafruit_GFX.h> #include <Adafruit_PCD8544.h> #define PIN_SCE 7 #define PIN_RESET 6 #define PIN_DC 5 #define PIN_SDIN 4 #define PIN_SCLK 3 // Software SPI (slower updates, more flexible pin options): //=== old version pin out====== // pin 7 - Serial clock out (SCLK)

// pin 6 - Serial data out (DIN) // pin 5 - Data/Command select (D/C) // pin 4 - LCD chip select (CS) // pin 3 - LCD reset (RST) Adafruit_PCD8544 display = Adafruit_PCD8544(PIN_SCLK, PIN_SDIN, PIN_DC, PIN_SCE, PIN_RESET); // Adafruit_PCD8544 display = Adafruit_PCD8544(SCLK, DIN, D/C, CS/SCE, RST); #define NUMFLAKES 10 #define XPOS 0 #define YPOS 1 #define DELTAY 2 void setup() { // put your setup code here, to run once: Serial.begin(9600); display.begin(); // init done //init Nokia 5110 display // you can change the contrast around to adapt the display // for the best viewing! display.setcontrast(50); //set Contrast display.cleardisplay(); // 清除螢幕 display.display(); // show splashscreen // // draw a single pixel display.drawpixel(10, 10, BLACK); display.drawpixel(10, 12, BLACK); display.drawpixel(10, 14, BLACK); display.drawpixel(10, 16, BLACK); display.drawpixel(10, 18, BLACK); display.drawpixel(10, 20, BLACK); display.drawpixel(14, 10, BLACK); display.drawpixel(14, 12, BLACK); display.drawpixel(14, 14, BLACK);

display.drawpixel(14, 16, BLACK); display.drawpixel(14, 18, BLACK); display.drawpixel(14, 20, BLACK); display.drawpixel(18, 10, BLACK); display.drawpixel(18, 12, BLACK); display.drawpixel(18, 14, BLACK); display.drawpixel(18, 16, BLACK); display.drawpixel(18, 18, BLACK); display.drawpixel(18, 20, BLACK); display.drawpixel(22, 10, BLACK); display.drawpixel(22, 12, BLACK); display.drawpixel(22, 14, BLACK); display.drawpixel(22, 16, BLACK); display.drawpixel(22, 18, BLACK); display.drawpixel(22, 20, BLACK); display.display(); // 顯示所有上面內容, 必要在所有秀字命令後, 一定要的 delay(2000); void loop() { // put your main code here, to run repeatedly: 程式下載網址 : https://github.com/brucetsao/makerdiwo/tree/master/201608 如下圖所示, 我們可以看到 Nokia 5110 LCD 模組畫出許多點 ( 曹永忠, 2016a, 2016b, 2016c, 2016d; 曹永忠, 許智誠, et al., 2015a, 2015b, 2015c, 2015d, 2015e, 2015f; 曹永忠, 許碩芳, et al., 2015a, 2015b)

圖 3 Nokia 5110 LCD 模組畫點測試程式一結果畫面 顯示線幾何圖形 首先, 我們要教讀者在 Nokia 5110 LCD 模組畫出線, 首先我們依上面電路組立將 Nokia 5110 LCD 模組與開發版連接完成, 再進行程式寫作 本程式需要用到兩個函式庫 ( 曹永忠, 2016e), 關於 Adafruit_PCD8544.h, 請到網址 : https://github.com/brucetsao/lib_for_mcu/tree/master/arduino_lib/libraries/adafr uit-pcd8544-nokia-5110 或 https://learn.adafruit.com/nokia-5110-3310-monochrome-lcd/graphics-library 或 https://github.com/adafruit/adafruit-pcd8544-nokia-5110-lcd-library, 進行下載, 關於 Adafruit_GFX.h, 請到網址 : https://github.com/brucetsao/lib_for_mcu/tree/master/arduino_lib/libr aries/adafruit_gfx, 進行下載 我們, 請讀者鍵入 Sketch IDE 軟體 ( 軟體下載請到 : https://www.arduino.cc/en/main/software), 編譯完成後上傳到開發版進行測

試 表 4 Nokia 5110 LCD 模組畫線測試程式一 Nokia 5110 LCD 模組畫線測試程式一 (NOKIA_Text_Show) /******************************************************************** * This is an example sketch for our Monochrome Nokia 5110 LCD Displays Pick one up today in the adafruit shop! ------> http://www.adafruit.com/products/338 These displays use SPI to communicate, 4 or 5 pins are required to interface Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above, and the splash screen must be included in any redistribution ********************************************************************* / #include <SPI.h> #include <Adafruit_GFX.h> #include <Adafruit_PCD8544.h> #define PIN_SCE 7 #define PIN_RESET 6 #define PIN_DC 5 #define PIN_SDIN 4 #define PIN_SCLK 3 // Software SPI (slower updates, more flexible pin options): //=== old version pin out====== // pin 7 - Serial clock out (SCLK)

// pin 6 - Serial data out (DIN) // pin 5 - Data/Command select (D/C) // pin 4 - LCD chip select (CS) // pin 3 - LCD reset (RST) Adafruit_PCD8544 display = Adafruit_PCD8544(PIN_SCLK, PIN_SDIN, PIN_DC, PIN_SCE, PIN_RESET); // Adafruit_PCD8544 display = Adafruit_PCD8544(SCLK, DIN, D/C, CS/SCE, RST); #define NUMFLAKES 10 #define XPOS 0 #define YPOS 1 #define DELTAY 2 void setup() { // put your setup code here, to run once: Serial.begin(9600); display.begin(); // init done //init Nokia 5110 display // you can change the contrast around to adapt the display // for the best viewing! display.setcontrast(50); //set Contrast display.cleardisplay(); // 清除螢幕 display.display(); // show splashscreen // // draw a single line for (int16_t i=0; i<display.width(); i+=4) { display.drawline(0, 0, i, display.height()-1, BLACK); display.display(); for (int16_t i=0; i<display.height(); i+=4) { display.drawline(0, 0, display.width()-1, i, BLACK); display.display();

display.display(); 要的 delay(2000); // 顯示所有上面內容, 必要在所有秀字命令後, 一定 void loop() { // put your main code here, to run repeatedly: 程式下載網址 : https://github.com/brucetsao/makerdiwo/tree/master/201608 如下圖所示, 我們可以看到 Nokia 5110 LCD 模組資畫出許多線 ( 曹永忠, 2016a, 2016b, 2016c, 2016d; 曹永忠, 許智誠, et al., 2015a, 2015b, 2015c, 2015d, 2015e, 2015f; 曹永忠, 許碩芳, et al., 2015a, 2015b) 圖 4 Nokia 5110 LCD 模組畫線測試程式一結果畫面

顯示矩形幾何形狀 首先, 我們要教讀者在 Nokia 5110 LCD 模組畫出幾何圖形 : 矩形, 首先我們依上面電路組立將 Nokia 5110 LCD 模組與開發版連接完成, 再進行程式寫作 本程式需要用到兩個函式庫 ( 曹永忠, 2016e), 關於 Adafruit_PCD8544.h, 請到網址 : https://github.com/brucetsao/lib_for_mcu/tree/master/arduino_lib/libraries/adafr uit-pcd8544-nokia-5110 或 https://learn.adafruit.com/nokia-5110-3310-monochrome-lcd/graphics-library 或 https://github.com/adafruit/adafruit-pcd8544-nokia-5110-lcd-library, 進行下載, 關於 Adafruit_GFX.h, 請到網址 : https://github.com/brucetsao/lib_for_mcu/tree/master/arduino_lib/libr aries/adafruit_gfx, 進行下載 我們, 請讀者鍵入 Sketch IDE 軟體 ( 軟體下載請到 : https://www.arduino.cc/en/main/software), 編譯完成後上傳到開發版進行測試 表 5 Nokia 5110 LCD 模組矩形幾何形狀測試程式一 Nokia 5110 LCD 模組矩形幾何形狀測試程式一 (NOKIA_drawGEO) /******************************************************************** * This is an example sketch for our Monochrome Nokia 5110 LCD Displays Pick one up today in the adafruit shop! ------> http://www.adafruit.com/products/338 These displays use SPI to communicate, 4 or 5 pins are required to interface Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing

products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above, and the splash screen must be included in any redistribution ********************************************************************* / #include <SPI.h> #include <Adafruit_GFX.h> #include <Adafruit_PCD8544.h> #define PIN_SCE 7 #define PIN_RESET 6 #define PIN_DC 5 #define PIN_SDIN 4 #define PIN_SCLK 3 // Software SPI (slower updates, more flexible pin options): //=== old version pin out====== // pin 7 - Serial clock out (SCLK) // pin 6 - Serial data out (DIN) // pin 5 - Data/Command select (D/C) // pin 4 - LCD chip select (CS) // pin 3 - LCD reset (RST) Adafruit_PCD8544 display = Adafruit_PCD8544(PIN_SCLK, PIN_SDIN, PIN_DC, PIN_SCE, PIN_RESET); // Adafruit_PCD8544 display = Adafruit_PCD8544(SCLK, DIN, D/C, CS/SCE, RST); #define NUMFLAKES 10 #define XPOS 0 #define YPOS 1 #define DELTAY 2 void setup() { // put your setup code here, to run once:

Serial.begin(9600); display.begin(); // init done //init Nokia 5110 display // you can change the contrast around to adapt the display // for the best viewing! display.setcontrast(50); //set Contrast display.cleardisplay(); // 清除螢幕 display.display(); // show splashscreen // // draw a 多個矩形 for (int16_t i=0; i<display.height()/2; i+=2) { display.drawrect(i, i, display.width()-2*i, display.height()-2*i, BLACK); display.display(); display.display(); 要的 delay(2000); // 顯示所有上面內容, 必要在所有秀字命令後, 一定 void loop() { // put your main code here, to run repeatedly: 程式下載網址 : https://github.com/brucetsao/makerdiwo/tree/master/201608 如下圖所示, 我們可以看到 Nokia 5110 LCD 模組畫出幾何圖形 : 矩形 ( 曹永忠, 2016a, 2016b, 2016c, 2016d; 曹永忠, 許智誠, et al., 2015a, 2015b, 2015c, 2015d, 2015e, 2015f; 曹永忠, 許碩芳, et al., 2015a, 2015b)

圖 5 Nokia 5110 LCD 模組矩形幾何形狀測試程式一結果畫面 顯示圓形幾何形狀 首先, 我們要教讀者在 Nokia 5110 LCD 模組畫出幾何圖形 : 圓形, 首先我們依上面電路組立將 Nokia 5110 LCD 模組與開發版連接完成, 再進行程式寫作 本程式需要用到兩個函式庫 ( 曹永忠, 2016e), 關於 Adafruit_PCD8544.h, 請到網址 : https://github.com/brucetsao/lib_for_mcu/tree/master/arduino_lib/libraries/adafr uit-pcd8544-nokia-5110 或 https://learn.adafruit.com/nokia-5110-3310-monochrome-lcd/graphics-library 或 https://github.com/adafruit/adafruit-pcd8544-nokia-5110-lcd-library, 進行下載, 關於 Adafruit_GFX.h, 請到網址 : https://github.com/brucetsao/lib_for_mcu/tree/master/arduino_lib/libr aries/adafruit_gfx, 進行下載 我們, 請讀者鍵入 Sketch IDE 軟體 ( 軟體下載請到 : https://www.arduino.cc/en/main/software), 編譯完成後上傳到開發版進行測

試 表 6 Nokia 5110 LCD 模組圓形幾何形狀測試程式一 Nokia 5110 LCD 模組圓形幾何形狀測試程式一 (NOKIA_drawGEO1) /******************************************************************** * This is an example sketch for our Monochrome Nokia 5110 LCD Displays Pick one up today in the adafruit shop! ------> http://www.adafruit.com/products/338 These displays use SPI to communicate, 4 or 5 pins are required to interface Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above, and the splash screen must be included in any redistribution ********************************************************************* / #include <SPI.h> #include <Adafruit_GFX.h> #include <Adafruit_PCD8544.h> #define PIN_SCE 7 #define PIN_RESET 6 #define PIN_DC 5 #define PIN_SDIN 4 #define PIN_SCLK 3 // Software SPI (slower updates, more flexible pin options): //=== old version pin out====== // pin 7 - Serial clock out (SCLK)

// pin 6 - Serial data out (DIN) // pin 5 - Data/Command select (D/C) // pin 4 - LCD chip select (CS) // pin 3 - LCD reset (RST) Adafruit_PCD8544 display = Adafruit_PCD8544(PIN_SCLK, PIN_SDIN, PIN_DC, PIN_SCE, PIN_RESET); // Adafruit_PCD8544 display = Adafruit_PCD8544(SCLK, DIN, D/C, CS/SCE, RST); #define NUMFLAKES 10 #define XPOS 0 #define YPOS 1 #define DELTAY 2 void setup() { // put your setup code here, to run once: Serial.begin(9600); display.begin(); // init done //init Nokia 5110 display // you can change the contrast around to adapt the display // for the best viewing! display.setcontrast(50); //set Contrast display.cleardisplay(); // 清除螢幕 display.display(); // show splashscreen // // draw a 多個矩形 for (int16_t i=0; i<display.height(); i+=6) { display.drawcircle(display.width()/2, display.height()/2, i/2, BLACK); display.display(); display.display(); 要的 delay(2000); // 顯示所有上面內容, 必要在所有秀字命令後, 一定

void loop() { // put your main code here, to run repeatedly: 程式下載網址 : https://github.com/brucetsao/makerdiwo/tree/master/201608 如下圖所示, 我們可以看到 Nokia 5110 LCD 模組畫出幾何圖形 : 圓形形狀 ( 曹永忠, 2016a, 2016b, 2016c, 2016d; 曹永忠, 許智誠, et al., 2015a, 2015b, 2015c, 2015d, 2015e, 2015f; 曹永忠, 許碩芳, et al., 2015a, 2015b) 圖 6 Nokia 5110 LCD 模組圓形幾何形狀測試程式一結果畫面

顯示三角形幾何形狀 首先, 我們要教讀者在 Nokia 5110 LCD 模組畫出幾何圖形 : 三角形幾何形狀, 首先我們依上面電路組立將 Nokia 5110 LCD 模組與開發版連接完成, 再進行程式寫作 本程式需要用到兩個函式庫 ( 曹永忠, 2016e), 關於 Adafruit_PCD8544.h, 請到網址 : https://github.com/brucetsao/lib_for_mcu/tree/master/arduino_lib/libraries/adafr uit-pcd8544-nokia-5110 或 https://learn.adafruit.com/nokia-5110-3310-monochrome-lcd/graphics-library 或 https://github.com/adafruit/adafruit-pcd8544-nokia-5110-lcd-library, 進行下載, 關於 Adafruit_GFX.h, 請到網址 : https://github.com/brucetsao/lib_for_mcu/tree/master/arduino_lib/libr aries/adafruit_gfx, 進行下載 我們, 請讀者鍵入 Sketch IDE 軟體 ( 軟體下載請到 : https://www.arduino.cc/en/main/software), 編譯完成後上傳到開發版進行測試 表 7 Nokia 5110 LCD 模組畫三角形幾何形狀測試程式一 Nokia 5110 LCD 模組畫三角形幾何形狀測試程式一 (NOKIA_drawGEO2) /******************************************************************** * This is an example sketch for our Monochrome Nokia 5110 LCD Displays Pick one up today in the adafruit shop! ------> http://www.adafruit.com/products/338 These displays use SPI to communicate, 4 or 5 pins are required to interface Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above, and the splash screen must be included in any redistribution ********************************************************************* / #include <SPI.h> #include <Adafruit_GFX.h> #include <Adafruit_PCD8544.h> #define PIN_SCE 7 #define PIN_RESET 6 #define PIN_DC 5 #define PIN_SDIN 4 #define PIN_SCLK 3 // Software SPI (slower updates, more flexible pin options): //=== old version pin out====== // pin 7 - Serial clock out (SCLK) // pin 6 - Serial data out (DIN) // pin 5 - Data/Command select (D/C) // pin 4 - LCD chip select (CS) // pin 3 - LCD reset (RST) Adafruit_PCD8544 display = Adafruit_PCD8544(PIN_SCLK, PIN_SDIN, PIN_DC, PIN_SCE, PIN_RESET); // Adafruit_PCD8544 display = Adafruit_PCD8544(SCLK, DIN, D/C, CS/SCE, RST); #define NUMFLAKES 10 #define XPOS 0 #define YPOS 1 #define DELTAY 2 void setup() { // put your setup code here, to run once: Serial.begin(9600);

display.begin(); // init done //init Nokia 5110 display // you can change the contrast around to adapt the display // for the best viewing! display.setcontrast(50); //set Contrast display.cleardisplay(); // 清除螢幕 display.display(); // show splashscreen // // draw a 多個矩形 for (int16_t i=0; i<display.height()/2; i+=4) { // display.drawtriangle(x0,y0,x1,y1,x2,y2, 顏色 ); display.drawtriangle(display.width()/2, i, 0+i*2, display.height()-2-i, display.width()-i*2, display.height()-2-i, BLACK); display.display(); // delay(2000) ; display.display(); 要的 delay(2000); // 顯示所有上面內容, 必要在所有秀字命令後, 一定 void loop() { // put your main code here, to run repeatedly: 程式下載網址 : https://github.com/brucetsao/makerdiwo/tree/master/201608 如下圖所示, 我們可以看到 Nokia 5110 LCD 模組畫出幾何圖形 : 三角形幾

何形狀 ( 曹永忠, 2016a, 2016b, 2016c, 2016d; 曹永忠, 許智誠, et al., 2015a, 2015b, 2015c, 2015d, 2015e, 2015f; 曹永忠, 許碩芳, et al., 2015a, 2015b) 圖 7 Nokia 5110 LCD 模組畫三角形幾何形狀測試程式一結果畫面 本文為 物聯網系列 系列第三篇 : 單色圖形顯示介紹 (NOKIA 5110 LCD 開發篇 ), 主要是介紹物聯網產品開發時, 常用的單色圖形微型 LCD 顯示介面, 如何顯示資料 文字 畫出幾何圖形等在顯示螢幕上 本篇是作者開啟的一個新專欄 : 物聯網系列, 主要是透過本專欄的介紹, 讓讀者可以了解物聯網 (Internet of Thing:IOT) 更多相關的使用 開發 設計等技術, 期望在往後專欄之中, 可以實作出更多物聯網的產品或實驗, 後續筆者還會繼續發表 物聯網系列 系列的文章, 在未來我們可以創造出更優質, 更具未來性的物聯網 (Internet of Thing:IOT) 產品開發相關技術 敬請期待更多的文章 筆者介紹曹永忠 (Yung-Chung Tsao): 目前為自由作家, 專注於軟體工程 軟體開發與

設計計 物件導向向程式設計計 物聯網系系統開發 Arduino 開發 嵌入式式系統開發, 商品品攝影及人人像攝影 長長期投入資資訊系統設計計與開發 企業應用系系統開發 軟體工工程 新產產品開發管理理 商品及及人像攝影等等領域, 並持續發表作作品及相關關專業著著作 Email:prgbruce@gmail. com,line ID:dr. brucetsaoo Arduino 部落格 :http://taiwanarduino.blogspot.tw// 臉書書社群 (Arduino.Taiwan):https://www.facebook.com/groups/Arduino.Taiwan/ 活動動官網 :http://arduino.kktix.cc/ Youtube:https://www. youtube.com/channel/uccyg2yy_u0m1aotca4hrrgq 程式式下載網址 :https://github.com/brucetsao/makerdiwo 參考考文獻 : 曹永永忠. (2016a). 物聯網系系列 : 彩色色顯示介紹 (2.4~3.2 TFT 基本篇篇 ) 智慧家庭. Retrieved from https://vmaker.tw/archives/10466 曹永永忠. (2016b). 物聯網系列 : 彩色色顯示介紹 (2.4~3.2 TFT 進階篇篇 ). 智慧家庭. Retrieved from https://vmaker.tw/archives/10466 曹永永忠. (2016c). 物聯網系系列 : 彩色色顯示介紹 (OLED LCD 篇 ). 智智慧家庭. Retrieved from http://vmaker. tw/project/view/1102 曹永永忠. (2016d). 物聯網系列 : 單色色圖形顯示介介紹 (NOKIA 5110 LCD 基本篇 ).) 智慧家庭. Retrieved from https://vmaker.tw/ 曹永永忠. (2016e). 智慧家庭 : 如何安安裝各類感測器的函式式庫. 智慧家家庭. Retrieved from http://vmaker. tw/project/view/651 曹永永忠, 許智誠, & 蔡英英德. (2015a). Arduino 程式教學 ( 入門篇 ):Arduino Programming (Basic Skills & Tricks) ( 初版 ed.). 台湾 彰化 : 渥玛数位有有限公司. 曹永永忠, 許智誠, & 蔡英英德. (2015b). Arduino 程式教學 ( 常用模組篇篇 ):Arduino Programming (37 Sensor Modules) ( 初版 ed.). 台湾湾 彰化 : 渥渥玛数位有有限公司. 曹永永忠, 許智誠, & 蔡英英德. (2015c). Arduino 程式教學 ( 無線通訊篇篇 ):Arduino Programming (Wireless Communication) ( 初版 ed.) ). 台湾 彰彰化 : 渥瑪數數位有限公公司. 曹永永忠, 許智誠, & 蔡英英德. (2015d). Arduino 编程教学 ( 无线通讯篇篇 ):Arduino

Programming (Wireless Communication) ( 初版 ed.). 台湾 彰化 : 渥瑪數位有限公司. 曹永忠, 許智誠, & 蔡英德. (2015e). Arduino 编程教学 ( 常用模块篇 ):Arduino Programming (37 Sensor Modules) ( 初版 ed.). 台湾 彰化 : 渥玛数位有限公司. 曹永忠, 許智誠, & 蔡英德. (2015f). Arduino 編程教学 ( 入门篇 ):Arduino Programming (Basic Skills & Tricks) ( 初版 ed.). 台湾 彰化 : 渥玛数位有限公司. 曹永忠, 許碩芳, 許智誠, & 蔡英德. (2015a). Arduino 程式教學 (RFID 模組篇 ):Arduino Programming (RFID Sensors Kit) ( 初版 ed.). 台湾 彰化 : 渥瑪數位有限公司. 曹永忠, 許碩芳, 許智誠, & 蔡英德. (2015b). Arduino 編程教学 (RFID 模块篇 ):Arduino Programming (RFID Sensors Kit) ( 初版 ed.). 台湾 彰化 : 渥瑪數位有限公司.