簡體   English   中英

用 Arduino 顯示 Unicode 個字符

[英]Displaying Unicode Characters with Arduino

我目前在 Arduino 上使用Keyboard.h 庫

我想在按下面包板上的按鈕時顯示以下字符:♥ ♦ ♣ ♠

我不太了解 ASCII、Unicode 和十六進制,所以我很難弄清楚

有人知道怎么做嗎?

謝謝。

嘗試Keyboard.print("\\uUNICODE_VALUE"); Unicode值可以在以下位置找到: http : //www.unicode.org/charts/

如果這在Linux上不起作用,則可以按Ctrl + Shift + u ,輸入unicode值,然后按Enter鍵,如下所示:

void typeUnicode(int val, int time){
    Keyboard.press(KEY_LEFT_CTRL);
    Keyboard.press(KEY_LEFT_SHIFT);
    Keyboard.press('u');
    delay(time);
    Keyboard.releaseAll();
    delay(time);
    Keyboard.println(String(val, HEX));
    delay(time);
}

在Windows上,您擁有“ ALT代碼”,並且由於我是UNIX極客,所以我不確定它們的工作方式。

請參閱我在https://arduino.stackexchange.com/a/91365/70109的回答,了解如何將 unicode 轉換為八進制 output

Arduino使用的GCC編譯器也不接受所有unicode序列如Using octal避免了這個問題。 在此處輸入圖像描述

Serial.print("\342\204\211");

如果接收器具有 unicode 的字體,將是 output ℉。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM