From 7525c2be037b914434178ab0c2e7d1eca57a8eab Mon Sep 17 00:00:00 2001 From: Kevin Loo Keng Leong Date: Wed, 19 Mar 2025 16:21:36 +0800 Subject: [PATCH 1/4] Add NTP example guide --- ...versal Time (UTC) by NTPClient library.rst | 84 ------------------- ...versal Time (UTC) by NTPClient library.rst | 75 +++++++++++++++++ .../ameba_d}/Example_Guides/NTP/index.rst | 14 ++-- source/ameba_d/amb21/Example_Guides/index.rst | 1 + source/ameba_d/amb23/Example_Guides/index.rst | 1 + source/ameba_d/amb25/Example_Guides/index.rst | 1 + source/ameba_d/amb26/Example_Guides/index.rst | 1 + .../ameba_d/aw-cu488/Example_Guides/index.rst | 1 + .../bw16-typeb/Example_Guides/index.rst | 1 + .../bw16-typec/Example_Guides/index.rst | 1 + source/custom_script.py | 21 +++-- 11 files changed, 103 insertions(+), 98 deletions(-) delete mode 100644 bak/ambd/_common/Example_Guides/NTP/NTP - Retrieve Universal Time (UTC) by NTPClient library.rst create mode 100644 source/_common/ameba_d/Example_Guides/NTP/NTP - Retrieve Universal Time (UTC) by NTPClient library.rst rename {bak/ambd/_common => source/_common/ameba_d}/Example_Guides/NTP/index.rst (93%) diff --git a/bak/ambd/_common/Example_Guides/NTP/NTP - Retrieve Universal Time (UTC) by NTPClient library.rst b/bak/ambd/_common/Example_Guides/NTP/NTP - Retrieve Universal Time (UTC) by NTPClient library.rst deleted file mode 100644 index eec2642..0000000 --- a/bak/ambd/_common/Example_Guides/NTP/NTP - Retrieve Universal Time (UTC) by NTPClient library.rst +++ /dev/null @@ -1,84 +0,0 @@ -########################################################################## -NTP - Retrieve Universal Time (UTC) by NTPClient library -########################################################################## - -.. role:: raw-html(raw) - :format: html - -:raw-html:`

` -**Preparation** -:raw-html:`

` - - - AmebaD [AMB21 / AMB22 / AMB23 / BW16] x 1 - -:raw-html:`

` -**Example** -:raw-html:`

` - - -In this example, we use an NTP client to sync with NTP -servers using UDP and keep track of time locally. -Open the example. -``“File” → “Examples”→ “NTPClient” → “Advanced”`` - - |image1| - -| Modify the highlighted code section (ssid, password) to connect to your WiFi network. - - |image2| - -| Compile the code and upload it to Ameba. After pressing the Reset button, Ameba - connects to WiFi, gets the UTC time from the NTP server, and prints out - the current time with time zone offset to the serial monitor. - - |image3| - -:raw-html:`

` -**Code Reference** -:raw-html:`

` - -| Configure NTP client: -| The NTPClient needs to use a UDP client for - communications. A WiFiUDP client is declared and passed to the NTPClient - constructor, along with an NTP server address, time zone offset in - seconds, and update interval in milliseconds. If detailed configuration - is not needed, just passing in the UDP client is also sufficient, refer - to the “NTPClient” → “Basic” example. - -.. code-block:: c - - WiFiUDP ntpUDP; - NTPClient timeClient(ntpUDP, "europe.pool.ntp.org", 3600, 60000); - -| Start NTP client: -| After connecting to WiFi, the NTPClient is started - using the ``begin()`` function, which causes the client to sync with the NTP - server and get the UTC time. - -.. code-block:: C - - WiFiUDP ntpUDP; - timeClient.begin(); - -| Get local time: -| ``getFormattedTime()`` is used to format the received UTC - time into the local time zone. ``update()`` is called every loop so that the - NTPClient will sync with the NTP server once every update interval. - -.. code-block:: C - - timeClient.update(); - timeClient.getFormattedTime(); - -.. |image1| image:: /media/ambd_arduino/NTP_Retrieve_Universal_Time_By_NTPClient_Library/image1.png - :width: 730 - :height: 1170 - :scale: 70 % -.. |image2| image:: /media/ambd_arduino/NTP_Retrieve_Universal_Time_By_NTPClient_Library/image2.png - :width: 731 - :height: 944 - :scale: 70 % -.. |image3| image:: /media/ambd_arduino/NTP_Retrieve_Universal_Time_By_NTPClient_Library/image3.png - :width: 779 - :height: 619 - :scale: 70 % \ No newline at end of file diff --git a/source/_common/ameba_d/Example_Guides/NTP/NTP - Retrieve Universal Time (UTC) by NTPClient library.rst b/source/_common/ameba_d/Example_Guides/NTP/NTP - Retrieve Universal Time (UTC) by NTPClient library.rst new file mode 100644 index 0000000..f3f6d84 --- /dev/null +++ b/source/_common/ameba_d/Example_Guides/NTP/NTP - Retrieve Universal Time (UTC) by NTPClient library.rst @@ -0,0 +1,75 @@ +NTP - Retrieve Universal Time (UTC) by NTPClient library +======================================================== + +.. contents:: + :local: + :depth: 2 + +Materials +--------- + +- AmebaD [AMB21 / AMB22 / AMB23 / BW16] x 1 + +Example +------- + +In this example, we use an NTP client to sync with NTP servers using UDP and keep track of time locally. +Open the example. “File” → “Examples”→ “NTPClient” → “Advanced” + +|image01| + +Modify the highlighted code section (ssid, password) to connect to your WiFi network. + +|image02| + +Compile the code and upload it to Ameba. After pressing the Reset button, Ameba connects to WiFi, gets the UTC time from the NTP server, and prints out the current time with time zone offset to the serial monitor. + +|image03| + + +**Code Reference** + +| Configure NTP client: +| The NTPClient needs to use a UDP client for + communications. A WiFiUDP client is declared and passed to the NTPClient + constructor, along with an NTP server address, time zone offset in + seconds, and update interval in milliseconds. If detailed configuration + is not needed, just passing in the UDP client is also sufficient, refer + to the “NTPClient” → “Basic” example. + +.. code-block:: c + + WiFiUDP ntpUDP; + NTPClient timeClient(ntpUDP, "europe.pool.ntp.org", 3600, 60000); + +| Start NTP client: +| After connecting to WiFi, the NTPClient is started + using the ``begin()`` function, which causes the client to sync with the NTP + server and get the UTC time. + +.. code-block:: C + + WiFiUDP ntpUDP; + timeClient.begin(); + +| Get local time: +| ``getFormattedTime()`` is used to format the received UTC + time into the local time zone. ``update()`` is called every loop so that the + NTPClient will sync with the NTP server once every update interval. + +.. code-block:: C + + timeClient.update(); + timeClient.getFormattedTime(); + +.. |image01| image:: ../../../../_static/amebad/Example_Guides/NTP/NTP_Retrieve_Universal_Time_By_NTPClient_Library/image01.png + :width: 730 + :height: 1170 + :scale: 70 % +.. |image02| image:: ../../../../_static/amebad/Example_Guides/NTP/NTP_Retrieve_Universal_Time_By_NTPClient_Library/image02.png + :width: 731 + :height: 944 + :scale: 80 % +.. |image03| image:: ../../../../_static/amebad/Example_Guides/NTP/NTP_Retrieve_Universal_Time_By_NTPClient_Library/image03.png + :width: 779 + :height: 619 \ No newline at end of file diff --git a/bak/ambd/_common/Example_Guides/NTP/index.rst b/source/_common/ameba_d/Example_Guides/NTP/index.rst similarity index 93% rename from bak/ambd/_common/Example_Guides/NTP/index.rst rename to source/_common/ameba_d/Example_Guides/NTP/index.rst index 74e4b48..d3eb413 100644 --- a/bak/ambd/_common/Example_Guides/NTP/index.rst +++ b/source/_common/ameba_d/Example_Guides/NTP/index.rst @@ -1,8 +1,8 @@ -NTP -=== - -.. toctree:: - :maxdepth: 1 - - NTP - Retrieve Universal Time (UTC) by NTPClient library +NTP +=== + +.. toctree:: + :maxdepth: 1 + + NTP - Retrieve Universal Time (UTC) by NTPClient library \ No newline at end of file diff --git a/source/ameba_d/amb21/Example_Guides/index.rst b/source/ameba_d/amb21/Example_Guides/index.rst index b335355..5bc6a71 100644 --- a/source/ameba_d/amb21/Example_Guides/index.rst +++ b/source/ameba_d/amb21/Example_Guides/index.rst @@ -7,6 +7,7 @@ Example Guides Basic/index E-Paper/index HTTP/index + NTP/index OTA/index Power Save/index SPI/index diff --git a/source/ameba_d/amb23/Example_Guides/index.rst b/source/ameba_d/amb23/Example_Guides/index.rst index 8bf280e..296e37b 100644 --- a/source/ameba_d/amb23/Example_Guides/index.rst +++ b/source/ameba_d/amb23/Example_Guides/index.rst @@ -9,6 +9,7 @@ Example Guides E-Paper/index FatfsSDIO/index HTTP/index + NTP/index OTA/index Power Save/index SPI/index diff --git a/source/ameba_d/amb25/Example_Guides/index.rst b/source/ameba_d/amb25/Example_Guides/index.rst index b335355..5bc6a71 100644 --- a/source/ameba_d/amb25/Example_Guides/index.rst +++ b/source/ameba_d/amb25/Example_Guides/index.rst @@ -7,6 +7,7 @@ Example Guides Basic/index E-Paper/index HTTP/index + NTP/index OTA/index Power Save/index SPI/index diff --git a/source/ameba_d/amb26/Example_Guides/index.rst b/source/ameba_d/amb26/Example_Guides/index.rst index b335355..5bc6a71 100644 --- a/source/ameba_d/amb26/Example_Guides/index.rst +++ b/source/ameba_d/amb26/Example_Guides/index.rst @@ -7,6 +7,7 @@ Example Guides Basic/index E-Paper/index HTTP/index + NTP/index OTA/index Power Save/index SPI/index diff --git a/source/ameba_d/aw-cu488/Example_Guides/index.rst b/source/ameba_d/aw-cu488/Example_Guides/index.rst index b335355..5bc6a71 100644 --- a/source/ameba_d/aw-cu488/Example_Guides/index.rst +++ b/source/ameba_d/aw-cu488/Example_Guides/index.rst @@ -7,6 +7,7 @@ Example Guides Basic/index E-Paper/index HTTP/index + NTP/index OTA/index Power Save/index SPI/index diff --git a/source/ameba_d/bw16-typeb/Example_Guides/index.rst b/source/ameba_d/bw16-typeb/Example_Guides/index.rst index 9e75361..fd019ff 100644 --- a/source/ameba_d/bw16-typeb/Example_Guides/index.rst +++ b/source/ameba_d/bw16-typeb/Example_Guides/index.rst @@ -7,6 +7,7 @@ Example Guides Basic/index E-Paper/index HTTP/index + NTP/index OTA/index Power Save/index SPI/index diff --git a/source/ameba_d/bw16-typec/Example_Guides/index.rst b/source/ameba_d/bw16-typec/Example_Guides/index.rst index 9e75361..fd019ff 100644 --- a/source/ameba_d/bw16-typec/Example_Guides/index.rst +++ b/source/ameba_d/bw16-typec/Example_Guides/index.rst @@ -7,6 +7,7 @@ Example Guides Basic/index E-Paper/index HTTP/index + NTP/index OTA/index Power Save/index SPI/index diff --git a/source/custom_script.py b/source/custom_script.py index 7acae46..3d781d8 100644 --- a/source/custom_script.py +++ b/source/custom_script.py @@ -9,31 +9,38 @@ board_mappings_d = { 'amb21': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' - , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP'], + , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' + , '_common/ameba_d/Example_Guides/NTP'], 'amb23': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' - , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP'], + , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' + , '_common/ameba_d/Example_Guides/NTP'], 'amb25': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' - , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP'], + , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' + , '_common/ameba_d/Example_Guides/NTP'], 'amb26': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' - , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP'], + , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' + , '_common/ameba_d/Example_Guides/NTP'], 'bw16-typeb': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' - , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP'], + , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' + , '_common/ameba_d/Example_Guides/NTP'], 'aw-cu488': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' - , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP'], + , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' + , '_common/ameba_d/Example_Guides/NTP'], 'bw16-typec': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' - , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP'], + , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' + , '_common/ameba_d/Example_Guides/NTP'], } def create_folder(folder_name): From b3ad5b826ebeaff895f3cb37c167b4a368f0414f Mon Sep 17 00:00:00 2001 From: Kevin Loo Keng Leong Date: Thu, 20 Mar 2025 13:53:08 +0800 Subject: [PATCH 2/4] Add RTC Example Guide - Ameba D RTC example guide --- .../RTC/RTC - Simple RTC Alarm.rst | 45 ---------------- .../Example_Guides/RTC/RTC - Simple RTC.rst | 49 ------------------ ...versal Time (UTC) by NTPClient library.rst | 2 +- .../RTC/RTC - Simple RTC Alarm.rst | 37 +++++++++++++ .../Example_Guides/RTC/RTC - Simple RTC.rst | 40 ++++++++++++++ .../ameba_d}/Example_Guides/RTC/index.rst | 16 +++--- .../image01.png | Bin .../image02.png | Bin .../image01.png | Bin .../image02.png | Bin source/ameba_d/amb21/Example_Guides/index.rst | 1 + source/ameba_d/amb23/Example_Guides/index.rst | 1 + source/ameba_d/amb25/Example_Guides/index.rst | 1 + source/ameba_d/amb26/Example_Guides/index.rst | 1 + .../ameba_d/aw-cu488/Example_Guides/index.rst | 1 + .../bw16-typeb/Example_Guides/index.rst | 1 + .../bw16-typec/Example_Guides/index.rst | 1 + 17 files changed, 93 insertions(+), 103 deletions(-) delete mode 100644 bak/ambd/_common/Example_Guides/RTC/RTC - Simple RTC Alarm.rst delete mode 100644 bak/ambd/_common/Example_Guides/RTC/RTC - Simple RTC.rst create mode 100644 source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC Alarm.rst create mode 100644 source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC.rst rename {bak/ambd/_common => source/_common/ameba_d}/Example_Guides/RTC/index.rst (91%) rename source/_static/amebad/Example_Guides/RTC/{RTC_Simple RTC => RTC_Simple_RTC}/image01.png (100%) rename source/_static/amebad/Example_Guides/RTC/{RTC_Simple RTC => RTC_Simple_RTC}/image02.png (100%) rename source/_static/amebad/Example_Guides/RTC/{RTC_Simple RTC Alarm => RTC_Simple_RTC_Alarm}/image01.png (100%) rename source/_static/amebad/Example_Guides/RTC/{RTC_Simple RTC Alarm => RTC_Simple_RTC_Alarm}/image02.png (100%) diff --git a/bak/ambd/_common/Example_Guides/RTC/RTC - Simple RTC Alarm.rst b/bak/ambd/_common/Example_Guides/RTC/RTC - Simple RTC Alarm.rst deleted file mode 100644 index a0cb9d9..0000000 --- a/bak/ambd/_common/Example_Guides/RTC/RTC - Simple RTC Alarm.rst +++ /dev/null @@ -1,45 +0,0 @@ -########################################## -RTC - Simple RTC Alarm -########################################## - -.. role:: raw-html(raw) - :format: html - -:raw-html:`

` -**Materials** -:raw-html:`

` - - - AmebaD [AMB21 / AMB22 / AMB23 / BW16] x 1 - -:raw-html:`

` -**Example** -:raw-html:`

` - -This example demonstrates how to use the RTC library methods to create a RTC Alarm, -so that to do some tasks when an alarm is matched. In particular, the RTC time is -set at 16:00:00 and an alarm at 16:00:10. When the time matches, “Alarm Match” -information will be printed on the serial monitor. - -First, select the correct Ameba development board from the Arduino IDE: -“Tools” → “Board”. - -Then open the "RTCAlarm" example from: -``“File” → “Examples” → “RTC” → “RTCAlarm”``: - - |1| - -In the example, the RTC time is set at 16:00:00 and an alarm is set at 16:00:10. -Upon successfully upload the sample code and press the reset button. -When the alarm time (10 seconds) is reached the attached interrupt function -will print the following information: “Alarm Matched!” showing in this figure below. - - |2| - -.. |1| image:: /media/ambd_arduino/RTC_Simple_RTC_Alarm/image1.png - :width: 543 - :height: 489 - :scale: 70 % -.. |2| image:: /media/ambd_arduino/RTC_Simple_RTC_Alarm/image2.png - :width: 598 - :height: 318 - :scale: 80 % \ No newline at end of file diff --git a/bak/ambd/_common/Example_Guides/RTC/RTC - Simple RTC.rst b/bak/ambd/_common/Example_Guides/RTC/RTC - Simple RTC.rst deleted file mode 100644 index f79c943..0000000 --- a/bak/ambd/_common/Example_Guides/RTC/RTC - Simple RTC.rst +++ /dev/null @@ -1,49 +0,0 @@ -############################################## -RTC - Simple RTC -############################################## - -.. role:: raw-html(raw) - :format: html - -:raw-html:`

` -**Materials** -:raw-html:`

` - - - AmebaD [AMB21 / AMB22 / AMB23 / BW16] x 1 - -:raw-html:`

` -**Example** -:raw-html:`

` - -This example demonstrates how to use the RTC library methods. This -function describes how to use the RTC API. The RTC function is -implemented by an independent BCD timer/counter. - -| Select the correct Ameba development board from the Arduino IDE: - "Tools" → "Board". -| Then open the “RTC” example from: -| ``"File" → "Examples" → "AmebaRTC" → "RTC"``: - - |1| - -Upon successfully upload the sample code and press the reset button, -this example will print out time information since the user initialized -time every second in the Serial Monitor. - - |2| - -:raw-html:`

` -**Code Reference** -:raw-html:`

` - -| [1] Simple RTC example from Arduino Tutorials: -| https://www.arduino.cc/en/Tutorial/SimpleRTC - -.. |1| image:: /media/ambd_arduino/RTC_Simple_RTC/image1.png - :width: 549 - :height: 462 - :scale: 70 % -.. |2| image:: /media/ambd_arduino/RTC_Simple_RTC/image2.png - :width: 597 - :height: 325 - :scale: 70 % \ No newline at end of file diff --git a/source/_common/ameba_d/Example_Guides/NTP/NTP - Retrieve Universal Time (UTC) by NTPClient library.rst b/source/_common/ameba_d/Example_Guides/NTP/NTP - Retrieve Universal Time (UTC) by NTPClient library.rst index f3f6d84..128509a 100644 --- a/source/_common/ameba_d/Example_Guides/NTP/NTP - Retrieve Universal Time (UTC) by NTPClient library.rst +++ b/source/_common/ameba_d/Example_Guides/NTP/NTP - Retrieve Universal Time (UTC) by NTPClient library.rst @@ -8,7 +8,7 @@ NTP - Retrieve Universal Time (UTC) by NTPClient library Materials --------- -- AmebaD [AMB21 / AMB22 / AMB23 / BW16] x 1 +- AmebaD [AMB21 / AMB22 / AMB23 / AMB25 / AMB26 / BW16 / AW-CU488 Thing Plus] x 1 Example ------- diff --git a/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC Alarm.rst b/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC Alarm.rst new file mode 100644 index 0000000..dd7f1a6 --- /dev/null +++ b/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC Alarm.rst @@ -0,0 +1,37 @@ +RTC - Simple RTC Alarm +====================== + +.. contents:: + :local: + :depth: 2 + +Materials +--------- + +- AmebaD [AMB21 / AMB22 / AMB23 / AMB25 / AMB26 / BW16 / AW-CU488 Thing Plus] x 1 + +Example +------- + +This example demonstrates how to use the RTC library methods to create a RTC Alarm, so that to do some tasks when an alarm is matched. In particular, the RTC time is set at 16:00:00 and an alarm at 16:00:10. When the time matches, “Alarm Match” +information will be printed on the serial monitor. + +First, select the correct Ameba development board from the Arduino IDE: “Tools” → “Board”. + +Then open the "RTCAlarm" example from: “File” → “Examples” → “RTC” → “RTCAlarm”: + +|image01| + +| In the example, the RTC time is set at 16:00:00 and an alarm is set at 16:00:10. +| Upon successfully upload the sample code and press the reset button. +| When the alarm time (10 seconds) is reached the attached interrupt function will print the following information: “Alarm Matched!” showing in this figure below. + +|image02| + +.. |image01| image:: ../../../../_static/amebad/Example_Guides/RTC/RTC_Simple_RTC_Alarm/image01.png + :width: 543 + :height: 489 + +.. |image02| image:: ../../../../_static/amebad/Example_Guides/RTC/RTC_Simple_RTC_Alarm/image01.png + :width: 598 + :height: 318 \ No newline at end of file diff --git a/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC.rst b/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC.rst new file mode 100644 index 0000000..26ec50e --- /dev/null +++ b/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC.rst @@ -0,0 +1,40 @@ +RTC - Simple RTC +================ + +.. contents:: + :local: + :depth: 2 + +Materials +--------- + +- AmebaD [AMB21 / AMB22 / AMB23 / AMB25 / AMB26 / BW16 / AW-CU488 Thing Plus] x 1 + +Example +------- + +This example demonstrates how to use the RTC library methods. This function describes how to use the RTC API. The RTC function is +implemented by an independent BCD timer/counter. + +| Select the correct Ameba development board from the Arduino IDE: "Tools" → "Board". +| Then open the “RTC” example from: "File" → "Examples" → "AmebaRTC" → "RTC": + +|image01| + +Upon successfully upload the sample code and press the reset button, this example will print out time information since the user initialized +time every second in the Serial Monitor. + +|image02| + +**Code Reference** + +| [1] Simple RTC example from Arduino Tutorials: +| https://www.arduino.cc/en/Tutorial/SimpleRTC + +.. |image01| image:: ../../../../_static/amebad/Example_Guides/RTC/RTC_Simple_RTC/image01.png + :width: 549 + :height: 462 + +.. |image02| image:: ../../../../_static/amebad/Example_Guides/RTC/RTC_Simple_RTC/image01.png + :width: 597 + :height: 325 \ No newline at end of file diff --git a/bak/ambd/_common/Example_Guides/RTC/index.rst b/source/_common/ameba_d/Example_Guides/RTC/index.rst similarity index 91% rename from bak/ambd/_common/Example_Guides/RTC/index.rst rename to source/_common/ameba_d/Example_Guides/RTC/index.rst index 194dc61..00071f3 100644 --- a/bak/ambd/_common/Example_Guides/RTC/index.rst +++ b/source/_common/ameba_d/Example_Guides/RTC/index.rst @@ -1,8 +1,8 @@ -RTC -=== - -.. toctree:: - :maxdepth: 1 - - RTC - Simple RTC Alarm - RTC - Simple RTC +RTC +=== + +.. toctree:: + :maxdepth: 1 + + RTC - Simple RTC Alarm + RTC - Simple RTC diff --git a/source/_static/amebad/Example_Guides/RTC/RTC_Simple RTC/image01.png b/source/_static/amebad/Example_Guides/RTC/RTC_Simple_RTC/image01.png similarity index 100% rename from source/_static/amebad/Example_Guides/RTC/RTC_Simple RTC/image01.png rename to source/_static/amebad/Example_Guides/RTC/RTC_Simple_RTC/image01.png diff --git a/source/_static/amebad/Example_Guides/RTC/RTC_Simple RTC/image02.png b/source/_static/amebad/Example_Guides/RTC/RTC_Simple_RTC/image02.png similarity index 100% rename from source/_static/amebad/Example_Guides/RTC/RTC_Simple RTC/image02.png rename to source/_static/amebad/Example_Guides/RTC/RTC_Simple_RTC/image02.png diff --git a/source/_static/amebad/Example_Guides/RTC/RTC_Simple RTC Alarm/image01.png b/source/_static/amebad/Example_Guides/RTC/RTC_Simple_RTC_Alarm/image01.png similarity index 100% rename from source/_static/amebad/Example_Guides/RTC/RTC_Simple RTC Alarm/image01.png rename to source/_static/amebad/Example_Guides/RTC/RTC_Simple_RTC_Alarm/image01.png diff --git a/source/_static/amebad/Example_Guides/RTC/RTC_Simple RTC Alarm/image02.png b/source/_static/amebad/Example_Guides/RTC/RTC_Simple_RTC_Alarm/image02.png similarity index 100% rename from source/_static/amebad/Example_Guides/RTC/RTC_Simple RTC Alarm/image02.png rename to source/_static/amebad/Example_Guides/RTC/RTC_Simple_RTC_Alarm/image02.png diff --git a/source/ameba_d/amb21/Example_Guides/index.rst b/source/ameba_d/amb21/Example_Guides/index.rst index 5bc6a71..7e5050f 100644 --- a/source/ameba_d/amb21/Example_Guides/index.rst +++ b/source/ameba_d/amb21/Example_Guides/index.rst @@ -10,5 +10,6 @@ Example Guides NTP/index OTA/index Power Save/index + RTC/index SPI/index WiFi/index \ No newline at end of file diff --git a/source/ameba_d/amb23/Example_Guides/index.rst b/source/ameba_d/amb23/Example_Guides/index.rst index 296e37b..369a4bd 100644 --- a/source/ameba_d/amb23/Example_Guides/index.rst +++ b/source/ameba_d/amb23/Example_Guides/index.rst @@ -12,5 +12,6 @@ Example Guides NTP/index OTA/index Power Save/index + RTC/index SPI/index WiFi/index \ No newline at end of file diff --git a/source/ameba_d/amb25/Example_Guides/index.rst b/source/ameba_d/amb25/Example_Guides/index.rst index 5bc6a71..7e5050f 100644 --- a/source/ameba_d/amb25/Example_Guides/index.rst +++ b/source/ameba_d/amb25/Example_Guides/index.rst @@ -10,5 +10,6 @@ Example Guides NTP/index OTA/index Power Save/index + RTC/index SPI/index WiFi/index \ No newline at end of file diff --git a/source/ameba_d/amb26/Example_Guides/index.rst b/source/ameba_d/amb26/Example_Guides/index.rst index 5bc6a71..7e5050f 100644 --- a/source/ameba_d/amb26/Example_Guides/index.rst +++ b/source/ameba_d/amb26/Example_Guides/index.rst @@ -10,5 +10,6 @@ Example Guides NTP/index OTA/index Power Save/index + RTC/index SPI/index WiFi/index \ No newline at end of file diff --git a/source/ameba_d/aw-cu488/Example_Guides/index.rst b/source/ameba_d/aw-cu488/Example_Guides/index.rst index 5bc6a71..7e5050f 100644 --- a/source/ameba_d/aw-cu488/Example_Guides/index.rst +++ b/source/ameba_d/aw-cu488/Example_Guides/index.rst @@ -10,5 +10,6 @@ Example Guides NTP/index OTA/index Power Save/index + RTC/index SPI/index WiFi/index \ No newline at end of file diff --git a/source/ameba_d/bw16-typeb/Example_Guides/index.rst b/source/ameba_d/bw16-typeb/Example_Guides/index.rst index fd019ff..839d5e3 100644 --- a/source/ameba_d/bw16-typeb/Example_Guides/index.rst +++ b/source/ameba_d/bw16-typeb/Example_Guides/index.rst @@ -10,5 +10,6 @@ Example Guides NTP/index OTA/index Power Save/index + RTC/index SPI/index WiFi/index diff --git a/source/ameba_d/bw16-typec/Example_Guides/index.rst b/source/ameba_d/bw16-typec/Example_Guides/index.rst index fd019ff..839d5e3 100644 --- a/source/ameba_d/bw16-typec/Example_Guides/index.rst +++ b/source/ameba_d/bw16-typec/Example_Guides/index.rst @@ -10,5 +10,6 @@ Example Guides NTP/index OTA/index Power Save/index + RTC/index SPI/index WiFi/index From 24106b98d735dba8630e5d639ea77c7a71880d90 Mon Sep 17 00:00:00 2001 From: Kevin Loo Keng Leong Date: Thu, 20 Mar 2025 14:41:17 +0800 Subject: [PATCH 3/4] Fix minor error --- .../Example_Guides/RTC/RTC - Simple RTC Alarm.rst | 2 +- .../Example_Guides/RTC/RTC - Simple RTC.rst | 6 +++--- source/custom_script.py | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC Alarm.rst b/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC Alarm.rst index dd7f1a6..b0daa71 100644 --- a/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC Alarm.rst +++ b/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC Alarm.rst @@ -32,6 +32,6 @@ Then open the "RTCAlarm" example from: “File” → “Examples” → “RTC :width: 543 :height: 489 -.. |image02| image:: ../../../../_static/amebad/Example_Guides/RTC/RTC_Simple_RTC_Alarm/image01.png +.. |image02| image:: ../../../../_static/amebad/Example_Guides/RTC/RTC_Simple_RTC_Alarm/image02.png :width: 598 :height: 318 \ No newline at end of file diff --git a/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC.rst b/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC.rst index 26ec50e..6100f9d 100644 --- a/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC.rst +++ b/source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC.rst @@ -33,8 +33,8 @@ time every second in the Serial Monitor. .. |image01| image:: ../../../../_static/amebad/Example_Guides/RTC/RTC_Simple_RTC/image01.png :width: 549 - :height: 462 + :height: 426 -.. |image02| image:: ../../../../_static/amebad/Example_Guides/RTC/RTC_Simple_RTC/image01.png +.. |image02| image:: ../../../../_static/amebad/Example_Guides/RTC/RTC_Simple_RTC/image02.png :width: 597 - :height: 325 \ No newline at end of file + :height: 324 \ No newline at end of file diff --git a/source/custom_script.py b/source/custom_script.py index 3d781d8..25ad1f7 100644 --- a/source/custom_script.py +++ b/source/custom_script.py @@ -10,37 +10,37 @@ 'amb21': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' - , '_common/ameba_d/Example_Guides/NTP'], + , '_common/ameba_d/Example_Guides/NTP', '_common/ameba_d/Example_Guides/RTC'], 'amb23': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' - , '_common/ameba_d/Example_Guides/NTP'], + , '_common/ameba_d/Example_Guides/NTP', '_common/ameba_d/Example_Guides/RTC'], 'amb25': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' - , '_common/ameba_d/Example_Guides/NTP'], + , '_common/ameba_d/Example_Guides/NTP', '_common/ameba_d/Example_Guides/RTC'], 'amb26': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' - , '_common/ameba_d/Example_Guides/NTP'], + , '_common/ameba_d/Example_Guides/NTP', '_common/ameba_d/Example_Guides/RTC'], 'bw16-typeb': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' - , '_common/ameba_d/Example_Guides/NTP'], + , '_common/ameba_d/Example_Guides/NTP', '_common/ameba_d/Example_Guides/RTC'], 'aw-cu488': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' - , '_common/ameba_d/Example_Guides/NTP'], + , '_common/ameba_d/Example_Guides/NTP', '_common/ameba_d/Example_Guides/RTC'], 'bw16-typec': ['_common/ameba_d/API_Documents/Analog', '_common/ameba_d/API_Documents/AudioCodec' , '_common/ameba_d/API_Documents/BLE', '_common/ameba_d/Example_Guides/OTA', '_common/ameba_d/API_Documents/EPDIF', '_common/ameba_d/API_Documents/FatfsSDcard', '_common/ameba_d/API_Documents/FlashMemory' , '_common/ameba_d/API_Documents/GPIO', '_common/ameba_d/Example_Guides/SPI', '_common/ameba_d/Example_Guides/Power Save', '_common/ameba_d/Example_Guides/WiFi', '_common/ameba_d/Example_Guides/HTTP' - , '_common/ameba_d/Example_Guides/NTP'], + , '_common/ameba_d/Example_Guides/NTP', '_common/ameba_d/Example_Guides/RTC'], } def create_folder(folder_name): From 613d1a6bba7bccfc39bd529d2518761c04c2d438 Mon Sep 17 00:00:00 2001 From: Kevin Loo Keng Leong Date: Thu, 20 Mar 2025 15:10:34 +0800 Subject: [PATCH 4/4] Update FAQ - Add gpio_pins_output_voltage --- source/FAQ/gpio_pins_output_voltage.rst | 17 +++++++++++++++++ source/FAQ/index.rst | 2 ++ 2 files changed, 19 insertions(+) create mode 100644 source/FAQ/gpio_pins_output_voltage.rst diff --git a/source/FAQ/gpio_pins_output_voltage.rst b/source/FAQ/gpio_pins_output_voltage.rst new file mode 100644 index 0000000..e787737 --- /dev/null +++ b/source/FAQ/gpio_pins_output_voltage.rst @@ -0,0 +1,17 @@ +.. tags:: gpio, voltage, output + +Why am I not getting 3.3V from my GPIO pins? +============================================ + +**Answer** + +Kindly verify that: + +1. You are measuring the correct GPIO pin, +2. GPIO pin is configured to produce OUTPUT HIGH signal, +3. No large load is connected to any of the GPIO pin, +4. GPIO pin is not configured to output PWM wave, +5. GPIO pin is not set to push-pull HIGH internally, +6. Your multimeter is set to correct range for DC voltage measurement (ensure that you are in DC voltage measurement not BATT mode). + +If possible, measure with an oscilloscope for a more accurate and reliable reading. diff --git a/source/FAQ/index.rst b/source/FAQ/index.rst index 2acaace..6ba6973 100644 --- a/source/FAQ/index.rst +++ b/source/FAQ/index.rst @@ -24,3 +24,5 @@ Ameba FAQ skb_unavaliable_warnings ameba-pro2_mipi_connection + + gpio_pins_output_voltage \ No newline at end of file