2023/11/05

VS Code 初始化的時候出現 Cannot find Arduino tools. Use Arduino CLI bundled with this extension instead? 要如何處理?



"安裝 Arduino Extension for VS code 時,如果遇到 “Cannot find Arduino tools. Use Arduino CLI bundled with this extension instead?”錯誤訊息。




請嘗試以下方法解決此問題。

解決步驟:


    1. Arduino: command path -> 保持為空白
    2. Arduino: path -> 保持為空白
    3. Arduino: Use Arduino Cli -> 勾選“Use Arduino CLI installed instated of the legacy Arduino IDE”
    4. 重新啟動 VS code

============ ENGLISH =====================

When install Arduino Extension for VS code, if you encountered "Cannot find Arduino tools. Use Arduino CLI bundled with this extension instead?" error message. Try this to fix it.


Steps to fix:


    1. Arduino: command path -> leave it empty
    2. Arduino: path -> leave it empty
    3. Arduino: Use Arduino Cli -> tick "Use Arduino CLI installed instated of the legacy Arduino IDE"
    4. Restart VS code





2023/09/29

[從零開始學習 App Inventor 系列] 之 自己來寫 APP 系列 - 新影片上架了~

 [從零開始學習 App Inventor 系列] 之 自己來寫 APP 系列,
有新單元推出囉~有興趣的朋友,趕緊來觀看!

別忘了點讚,按下喜歡及分享給好朋友喔~



這個是一個專門為初學者來開發的一個系列, 所以會講的比較詳細, 

相信各位只要仔細收看內容並進行實作, 一定會收獲滿滿滿!! :)


(0) 課程簡介 https://youtu.be/gkGW8bnO66w

(1) 基本認識, 環境設定及註冊帳號 https://youtu.be/BesQP6GckjE

(2) 使用者 / 程式設計介面介紹 (忘了增加開發流程介紹 / ) https://youtu.be/ukV7c5IWMaA

(3) 動手寫程式吧! (犬犬汪汪 App) https://youtu.be/kih39aqtI64

(4) App 開發流程 / 各式變數介紹 https://youtu.be/L9jtQBDIzow

(5) 單位換算 App 之實作練習 https://youtu.be/f4l6uckAfEo

(6) 條件判斷式 (if then else) https://youtu.be/y8MVDTkskHA

(7) 高鐵票優惠計算 App 實作練習 https://youtu.be/30Sq8610WFk

(8) 待續... 

2023/09/16

[從零開始學習 App Inventor 系列] 之 自己來寫 APP 系列

Stonez56 推出全新的單元 -
[從零開始學習 App Inventor 系列] 之 自己來寫 APP 系列 


這個是一個專門為初學者來開發的一個系列, 所以會講的比較詳細,

相信各位只要仔細收看內容並進行實作, 一定會收獲滿滿滿!! :)

自己來寫 APP 課程內容:

(0) 課程簡介



   (1) 基本認識, 環境設定及註冊帳號

  • 本集內容主要包括了以下內容: 
  • - AppInventor介紹 
  • - 基本需求 
  • - 環境設定 
  • - 如何註冊帳號


  (2) 使用者 / 程式設計介面介紹

  • 本集內容主要包括了以下內容: 
  • - 主界面介紹 
  • - 程式設計界面介紹


  (3) 動手寫程式吧! (犬犬汪汪 App)

  • 本集內容主要包括了以下內容: 
  • - 寫出 小狗汪汪 App
  • - 測驗 寫出猫咪喵喵 App



   (4) App 開發流程 / 各式變數介紹

  • 本集內容主要包括了以下內容: 
  • - App 開發流程  (四思而後行)
  • - 什麼是變數?
  • - 全域變數 & 區域變數 App 實作
  • - 各式變數型別介紹 - 數字, 字串, 布林, 顏色


#stonez56, #weekendproject , #EPS32, #ESP8226, #Arduinoproject, #Arduino, #IOTprojects, #tutorials, #Raspberrypi, #虛擬容器, #IOT, #樹莓派, #docker, #rclone, #mqtt, #appinventor, app inventortutorial , #appinventor2教學, #樹莓派教學, #iotproject, #u8G2, #wifimanager, #ESP32 FOTA, #FOTA, #VScode, #lighttracing, #lighttracking, #voicecontrol, #IFTTT, #Adafruit, #Scratch, #Tello, #PIRsensor, #rgbledcontroller, #WS2812B, #LCD, #Temperaturesensor, #uwb, #uwb technology, #lora, #loramodule, #loratest, #從零開始學習AppInventor!, #自己來寫APP

2023/06/23

Arduino #48集, 用一塊ESP32來學 IOT (#48 Learn IOT with MQTT + ESP32) 把 MQTTlens 換成 EMQX MQTT Web Client

大家好, 今天和大家來分享, Arduino #48集, 用一塊ESP32來學 IOT (#32 Learn IOT with MQTT + ESP32)   這個影片很適合初學者來觀看學習. 

影片內容主要是告訴大家,  只要手上有一塊 ESP32 和一台電腦, 就可以開始學習 IOT 了 !   看過這個影片, 你會了解學習 IOT 一點都不難喔! 甚至可以延伸作法, EMQX MQTT web client 透過雲端EMQX來做遠端的控制! 


使用 MQTT 來幫助你快速完成第一個 IoT專案

有幾位朋友寫信來告知, MQTTLens 這個 Chrome 流覽器插件(extension) 已經無法再使用了, 所以我把這個教學的流程, 整理一下, 改用了 EMQX 本身自有的 MQTT web client 來做這個教學. 

這個是一個專門為初學者來開發的一個系列, 所以會講的比較詳細, 相信各位只要仔細收看內容並進行實作, 一定會收獲滿滿滿。好, 那我們就開始吧今天的練習吧~




如果時間不夠的朋友, 也可以從以下的時間軸挑選想看的部份即可!

影片時間軸:

00:00 開始

01:03 什麼是 MQTT,它是如何運作的?

02:29 打造你的第一個MQTT IOT專案!

03:34 MQTT 程式:pubsubclient

04:27 Arduino IDE: 設定Additional Boards Manager URL

04:55 Arduino IDE 其它設定

05:22 從我的部落格中下載程式並貼在Arduino IDE

05:51 在程式中更改必要的設定

08:55 使用 EMQX MQTT web client

09:34 EMQX 簡易設定

11:39 訂閱 ESP32上的主題

14:30 從EMQX MQTT client 訂閱主題

16:52 從EMQX MQTT client 發佈主題 Stonez56/esp32s




參考資料:

///
/*
 Basic ESP8266 MQTT example
 This sketch demonstrates the capabilities of the pubsub library in combination
 with the ESP8266 board/library.
 It connects to an MQTT server then:
  - publishes "hello world" to the topic "outTopic" every two seconds
  - subscribes to the topic "inTopic", printing out any messages
    it receives. NB - it assumes the received payloads are strings not binary
  - If the first character of the topic "inTopic" is an 1, switch ON the ESP Led,
    else switch it off
 It will reconnect to the server if the connection is lost using a blocking
 reconnect function. See the 'mqtt_reconnect_nonblocking' example for how to
 achieve the same result without blocking the main loop.
 To install the ESP8266 board, (using Arduino 1.6.4+):
  - Add the following 3rd party board manager under "File -&nbgt; Preferences -&nbgt; Additional Boards Manager URLs":
       http://arduino.esp8266.com/stable/package_esp8266com_index.json
  - Open the "Tools -&nbgt; Board -&nbgt; Board Manager" and click install for the ESP8266"
  - Select your ESP8266 in "Tools -&nbgt; Board"
*/
 
#include &nblt;WiFi.h&nbgt;
#include &nblt;PubSubClient.h&nbgt;
#include &nblt;EasyButton.h&nbgt;
#define LED 2        //built-in LED on ESP32
 
// Update these with values suitable for your network.
const char *ssid = "Stonez24";
const char *password = "a0101010101a";
 
// Define your client ID on EMQX
String mqtt_ClientID = "stonez56_IOT_Station_";
 
// Define your topics to subscribe / publish
const char* sub_topic = "stonez56/esp32s";
const char* pub_led_topic = "stonez56/esp32s_led_state";
const char* pub_init_topic = "stonez56/esp32s_is_back";
 
// EMQX broker parameters
const char *mqtt_server = "broker.emqx.io";
const char *mqtt_userName = "emqx";
const char *mqtt_password = "public";
 
WiFiClient espClient;
PubSubClient client(espClient);
unsigned long lastMsg = 0;
#define MSG_BUFFER_SIZE (50)
char msg[MSG_BUFFER_SIZE];
int value = 0;
 
void setup_wifi()
{
    delay(10);
    // We start by connecting to a WiFi network
    Serial.println();
    Serial.print("Connecting to ");
    Serial.println(ssid);
 
    WiFi.mode(WIFI_STA);
    WiFi.begin(ssid, password);
 
    while (WiFi.status() != WL_CONNECTED)
    {
        delay(500);
        Serial.print(".");
    }
 
    randomSeed(micros());
 
    Serial.println("");
    Serial.println("WiFi connected");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
}
 
void callback(char *topic, byte *payload, unsigned int length)
{
    Serial.print("Message arrived [");
    Serial.print(topic);
    Serial.print("] ");
    for (int i = 0; i &nblt; length; i++)
    {
        Serial.print((char)payload[i]);
    }
    Serial.println();
 
    payload[length] = '\0';
    String message = (char *)payload;
    
    if (strcmp(topic, sub_topic) == 0)
    {
        if (message == "off")
        {
            digitalWrite(LED, LOW); //Turn off
            client.publish(pub_led_topic, "LED off");
        }
        if (message == "on")
        {
            digitalWrite(LED, HIGH); //Turn on
            client.publish(pub_led_topic, "LED on");
        }
        if (message == "flash")
        {
            digitalWrite(LED, LOW); //LED flashing 2 times
            delay(200);
            digitalWrite(LED, HIGH); 
            delay(200);
            digitalWrite(LED, LOW); 
            delay(200);
            digitalWrite(LED, HIGH); 
            delay(200);
            digitalWrite(LED, LOW); 
            client.publish(pub_led_topic, "LED flashed 2 times");
        }        
    }
 
    /* Switch on the LED if an 1 was received as first character
    // if ((char)payload[0] == '1')
    // {
    //     digitalWrite(BUILTIN_LED, LOW); // Turn the LED on (Note that LOW is the voltage level
    //                                     // but actually the LED is on; this is because
    //                                     // it is active low on the ESP-01)
    // }
    // else
    // {
    //     digitalWrite(BUILTIN_LED, HIGH); // Turn the LED off by making the voltage HIGH
    // } */
}
 
void reconnect()
{
    // Loop until we're reconnected
    while (!client.connected())
    {
 
        Serial.println("Attempting EMQX MQTT connection...");
        // Create a random client ID
        mqtt_ClientID += String(random(0xffff), HEX);
        // Attempt to connect
        if (client.connect((mqtt_ClientID, mqtt_userName, mqtt_password)))
        {
            Serial.print(" connected with Client ID: ");
            Serial.println(mqtt_ClientID);
            // Once connected, publish an announcement...
            client.publish(pub_init_topic, "Hi, I'm online!");
            // ... and resubscribe
            client.subscribe(sub_topic);
        }
        else
        {
            Serial.print("failed, rc=");
            Serial.print(client.state());
            Serial.println(" try again in 5 seconds");
            // Wait 5 seconds before retrying
            delay(5000);
        }
    }
}
 
void setup()
{
    pinMode(LED, OUTPUT); // Initialize the _LED pin as an output
    digitalWrite(LED, LOW); //default ESP32 LOW is turn off
 
    Serial.begin(115200);
    setup_wifi();
    client.setServer(mqtt_server, 1883);
    client.setCallback(callback);
}
 
void loop()
{
 
    if (!client.connected())
    {
        reconnect();
    }
    client.loop();
 
    /* unsigned long now = millis();
    // if (now - lastMsg &nbgt; 2000)
    // {
    //     lastMsg = now;
    //     ++value;
    //     snprintf(msg, MSG_BUFFER_SIZE, "hello world #%ld", value);
    //     Serial.print("Publish message: ");
    //     Serial.println(msg);
    //     client.publish("stonez56/esp32s_button_pushed", msg);
    // } */
}

2023/01/29

App Inventor #13 掃瞄條碼直送 Google Sheets (Scan barcodes and save to Google Sheets)

 大家好, 歡迎收看本週的Weekend project with Stonez56!


本周要進行的是 App Inventor #13 掃瞄條碼後, 直接儲存到 Google Sheets!  

掃描條碼是學習APP inventor很重要的一個技巧, 但是它也非常的簡單使用. 所以我們來加深一些難度.  今天我們來教大家如何把掃描到的條碼存放在Listview, 再把掃瞄的文字內容直接儲存到 Google sheets.


在本影片中你將會學習到:

 - 設定 Google sheets API

 - 在APP inventor中使用條碼

 - 如何把條碼儲存到 Listview

 - 如何把條碼掃描的內容文字儲存到Google sheets 




如果時間不夠的朋友, 也可以從以下的時間軸挑選想看的部份即可! 


影片時間軸: 

00:00 開始

01:37 條碼 App 示範

02:52 設定 Google Sheet API 

09:24 建立一個 Google Sheet並做好設定

09:52 如何獲取 Google SheetID

11:21 建立 App 使用者界面

18:31 上傳 Spreadsheet Json Key & 設置 SheetID

19:31 開始撰寫應用程式


App Inventor 相關教學影片:


* App Inventor #13 掃瞄條碼直送 Google Sheets

https://youtu.be/nrILklGhKIA


* App Inventor #12 自己來寫 APP - 用骰子遊戲學IoT 

https://youtu.be/d5jQHN1zguQ


* App Inventor #11自己來寫 App - 骰子遊戲 (Dice Game)

https://youtu.be/2d6Si6u8FVE


* App Inventor #10 集 自己來寫 APP YouBike 2.0 (下). 

https://youtu.be/Cli-_lUPjgU


* App Inventor #9 集 - 自己來寫 APP YouBike 2.0 (上) 

https://youtu.be/D78-eDRFiXM


*App Inventor #8 AI2 Companion 一直斷線怎麼辦? AI2 小技巧 (How to keep AI2 always connected for Android) https://youtu.be/_HeM9GyVmIE


* App Inventor #7 ESP32 語音辨識控制 IOT 專案, 使用 IoT Essential Library Example (CC available)  https://youtu.be/senjdb-cREY


* App Inventor #6 使用’ 繪圖動畫' 製作使用者介面 (App Inventor 2 UI design with Draw and Animation) https://youtu.be/RfYi8h9y6kE


* App Inventor #5 - “無線搖控 ESP32-CAM APP 下集 (Write ESP32-CAM remote APP 2/2) https://youtu.be/J8b3zWX1FXM


* App Inventor #4 無線搖控 ESP32-CAM APP 上集 (Write ESP32-CAM remote APP 1/2)

https://youtu.be/x545mFSZWgg


* App Inventor #3 “自己來寫APP 快篩何處買?” (How to process .csv files in App Inventor)

https://youtu.be/u5J4FJQ5UQQ


* App Inventor #2 “自己來寫mqtt APP Android & iOS都能用” (Create MQTT Apps with App Inventor 2)

https://youtu.be/kIONEfLO4sI


* MIT App Inventor 2 #1 - 語音辨識 (Voice Recognition)

https://youtu.be/msV4V6af6tA

2023/01/02

Arduino #42集, “快速取得u8g2的字型代碼” (Get u8g2 unifont code quick & easy, u8g2 のフォント コードをすばやく取得する」です, u8g2용 폰트코드 빠르게 받아보기" 입니다)

歡迎收看Weekend project with Stonez56。 
本周是Arduino #42集, “快速取得u8g2的字型代碼”
我們將使用Stonez56 這個網站來快速取得字型代碼

目前為測試版: https://stonez56.com/u8g2/

這個 Stonez56 轉碼網站過人之處:

* 簡單易用用省時
* 自動移除重複字
* 產生極小的檔案 

使用方法簡單:

* 輸入你要轉換的字詞
* 按下送出
* 下載產生的字型代碼
* 存到 Arduino 專案目錄下
* 在你的主程式中, 用 include 帶進 字型.h 程式
* 用 u8g2.setFont(u8g2_font_unifont_myfonts) 

目前為測試版: https://stonez56.com/u8g2/




===========================
Stonez56 の Weekend プロジェクトへようこそ。
今週は Arduino #42 のエピソード「u8g2 のフォント コードをすばやく取得する」です。
Web サイト Stonez56 を使用して、フォント コードをすばやく取得します。

現在ベータ版:https://stonez56.com/u8g2/

この Stonez56 トランスコーディング サイトの優れた点:
*使いやすく、時間を節約
*重複する単語を自動的に削除
* 非常に小さいファイルを生成します

使いやすい:
*変換したい単語を入力してください
※押すと送信されます
* 生成されたフォント コードをダウンロードする
* Arduino プロジェクト ディレクトリに保存します。
* メイン プログラムで、include を使用して font.h プログラムを取り込みます。
* u8g2.setFont(u8g2_font_unifont_myfonts) を使用

現在ベータ版:https://stonez56.com/u8g2/


=============================
Stonez56과 함께하는 주말 프로젝트에 오신 것을 환영합니다.
이번주는 아두이노 #42편 "u8g2용 폰트코드 빠르게 받아보기" 입니다.
Stonez56 웹 사이트를 사용하여 글꼴 코드를 빠르게 얻습니다.

현재 베타 버전: https://stonez56.com/u8g2/

이 Stonez56 트랜스코딩 사이트의 장점:
* 사용하기 쉽고 시간을 절약
* 중복 단어 자동 제거
* 매우 작은 파일 생성

사용하기 쉬운:
* 변환하려는 단어를 입력하십시오
* 누르면 보내기
* 생성된 글꼴 코드 다운로드
* Arduino 프로젝트 디렉토리에 저장
* 기본 프로그램에서 include를 사용하여 font.h 프로그램을 가져옵니다.
* u8g2.setFont(u8g2_font_unifont_myfonts) 사용

현재 베타 버전: https://kidsgo.net/u8g2/

#arduino #u8g2 #font #lcd #display #weekendprojectwithstonez56 #diy #maker #oled #esp32 #esp8266 #stonez56 #fontgenerator #kidsgo.net #CJKfonts #CJK

2022/12/10

如何解決 ESPAsyncWebServer 錯誤 - undefined reference to `mbedtls_md5_starts' (Solving ESPAsyncWebServer - undefined reference to `mbedtls_md5_starts issues )




最近在使用 ESPAsyncWebServer 時, 發生了一個編譯的錯誤:

c:/users/stone/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: d:\stone\Documents\build\libraries\ESPAsyncWebServer-master\WebAuthentication.cpp.o:(.literal._ZL6getMD5PhtPc+0x4): undefined reference to `mbedtls_md5_starts'


看來是 ESPAsyncWebServer 的問題, 於是我到 Git Hub 找到了 ESPAsyncWebServer https://github.com/me-no-dev/ESPAsyncWebServer 從新下載, 更新了 Library 還是沒有辦法, 錯誤依然存在, 無法解決. 

經過了3個小時反覆搜尋, 發現這是 ESPAsyncWebServer 的一個 issue, 目前還沒有被修正. 

不過, 在底下有高手提出了解決方法:
找到 WebAuthentication.cpp 然在大約 72 行左右, 

modify in the library directory your_directory/Arduino/libraries/ESPAsyncWebServer-master/src/WebAuthentication.cpp  @line 72 with this (the comment are the old line ......)

只要把原來的後3行紅色註解掉(//), 加上4個藍色新程式碼, 即可以修正!

#ifdef ESP32
mbedtls_md5_init(&_ctx);
mbedtls_md5_update_ret (&_ctx,data,len);
mbedtls_md5_finish_ret(&_ctx,data);
mbedtls_internal_md5_process( &_ctx ,data);

// mbedtls_md5_starts(&_ctx);
// mbedtls_md5_update(&_ctx, data, len);
// mbedtls_md5_finish(&_ctx, _buf);


-----------ENGLISH-------------

When I tried to compile ESPAsyncWebServer with AsyncElegantOTA, the following error occured:

c:/users/stone/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: d:\stone\Documents\build\libraries\ESPAsyncWebServer-master\WebAuthentication.cpp.o:(.literal._ZL6getMD5PhtPc+0x4): undefined reference to `mbedtls_md5_starts'


It looked like the ESPAsyncWebsrver issue, so I went to GitHub to re-download ESPAsyncWebServer (https://github.com/me-no-dev/ESPAsyncWebServer ) and then updated the library. However, this didn't solve the issue that the same error still stopping me from compile it for my ESP32.

After couple of hours, I realized that this was an error that didn't have a proper fixed yet. However, someone at Github provided a solution and it worked for me:

In line 72 of the WebAuthentication.cpp file:

modify in the library directory your_directory/Arduino/libraries/ESPAsyncWebServer-master/src/WebAuthentication.cpp  @line 72 with this (the comment are the old line ......)

Just comment these red in comment below and add the blue codes, then compile went fine without issues!

#ifdef ESP32
mbedtls_md5_init(&_ctx);
mbedtls_md5_update_ret (&_ctx,data,len);
mbedtls_md5_finish_ret(&_ctx,data);
mbedtls_internal_md5_process( &_ctx ,data);

// mbedtls_md5_starts(&_ctx);
// mbedtls_md5_update(&_ctx, data, len);
// mbedtls_md5_finish(&_ctx, _buf);