> For the complete documentation index, see [llms.txt](https://cavedu.gitbook.io/linkit-7697/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cavedu.gitbook.io/linkit-7697/linkit-7697-blocklyduino-shi-yong-zhi-nan/shi-zuo-fan-li-jiao-xue/b06.-grove-oled-xian-shi-qi.md).

# B06. Grove OLED 顯示器

### 專案說明 <a href="#b05.groveled-deng-tiao-zhuan-an-shui-ming" id="b05.groveled-deng-tiao-zhuan-an-shui-ming"></a>

使用 **Grove擴充板** 連接 **OLED 顯示器** ([Grove -](http://wiki.seeed.cc/Grove-Relay/)[ OLED Display](http://wiki.seeed.cc/Grove-OLED_Display_0.96inch/))，印出一些整數，浮點數和字串。

{% hint style="info" %}
此**顯示器**包含於 [Grove Starter Kit for LinkIt 7697](https://robotkingdom.com.tw/product/linkit-7697kit/) 內. 使用此範例前請先閱讀[ **Grove 相關基礎知識**](https://cavedu.gitbook.io/linkit-7697/linkit-7697-blocklyduino-shi-yong-zhi-nan/shi-zuo-fan-li-jiao-xue/b00.-grove-xiang-guan-ji-chu-zhi-shi)， 並依照其內的說明步驟[**安裝 Grove 相關驅動程式**](https://cavedu.gitbook.io/linkit-7697/linkit-7697-blocklyduino-shi-yong-zhi-nan/shi-zuo-fan-li-jiao-xue/b00.-grove-xiang-guan-ji-chu-zhi-shi#b00.grove-xiang-guan-ji-chu-zhi-shi-an-zhuang-starterkit-nei-de-grove-zhou-bian-de-qu-dong-cheng-shi)
{% endhint %}

![](/files/I8ID2FYZHLD97QjkvozY)

### 電路圖  <a href="#b06.groveoled-xian-shi-qi-dian-lu-tu" id="b06.groveoled-xian-shi-qi-dian-lu-tu"></a>

* [LinkIt 7697](https://robotkingdom.com.tw/product/linkit-7697/)
* [Grove breakout for LinkIt 7697](https://robotkingdom.com.tw/product/linkit-7697-2/)
* [Grove - OLED Display 0.96"](https://www.seeedstudio.com/Grove-OLED-Display-0.96%22-p-781.html)&#x20;

{% hint style="info" %}
**此 OLED 顯示器**是使用 [**I2C**](https://zh.wikipedia.org/wiki/I%C2%B2C) **訊號** 輸出輸入，I2C 的通訊原理是可以串接多個裝置，此範例可以連接 **I2C** 的三個連接埠的任一個皆可得到一樣的效果
{% endhint %}

{% hint style="info" %}
此 **OLED 顯示器**解析度為 **128 x 64** 點，單色顯示
{% endhint %}

![](/files/7G28VvNPr1Gn748JtUWM)

### 積木畫布 <a href="#b06.groveoled-xian-shi-qi-ji-mu-hua-bu" id="b06.groveoled-xian-shi-qi-ji-mu-hua-bu"></a>

![](/files/rNHdtRvElG4NwKjizeVf)

產生出的 arduino 程式如下

```
#include <Wire.h>
#include <SeeedOLED.h>

void setup()
{

  Wire.begin();
  SeeedOled.init();
  SeeedOled.deactivateScroll();
  SeeedOled.setPageMode();
}

void loop()
{
  SeeedOled.clearDisplay();
  SeeedOled.setTextXY(0, 0);
  SeeedOled.putNumber(54321);
  SeeedOled.setTextXY(1, 0);
  SeeedOled.putFloat(3.1415);
  SeeedOled.setTextXY(2, 0);
  SeeedOled.putString("Hello");
  delay(1000);
}
```

OLED 顯示器輸出如下

![](/files/mgWVnK6dWSbnsPErumtL)

### FAQ <a href="#b06.groveoled-xian-shi-qi-faq" id="b06.groveoled-xian-shi-qi-faq"></a>

**Q: 上傳程式到開發板時會產生以下錯誤，無法燒錄**

NameError: name 'exit' is not defined

![](/files/AJPCLqb2um9dVOzRHHVt)

A: 此為搭配 OLED 顯示器會產生的無法上傳的不明錯誤, 目前尚不知問題原因. 若發生請先插拔 USB 在重插一次就可避免這問題.
