Skip to content

Update FAQ and add Example Guides #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

45 changes: 0 additions & 45 deletions bak/ambd/_common/Example_Guides/RTC/RTC - Simple RTC Alarm.rst

This file was deleted.

49 changes: 0 additions & 49 deletions bak/ambd/_common/Example_Guides/RTC/RTC - Simple RTC.rst

This file was deleted.

17 changes: 17 additions & 0 deletions source/FAQ/gpio_pins_output_voltage.rst
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions source/FAQ/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ Ameba FAQ
skb_unavaliable_warnings

ameba-pro2_mipi_connection

gpio_pins_output_voltage
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
NTP - Retrieve Universal Time (UTC) by NTPClient library
========================================================

.. contents::
:local:
:depth: 2

Materials
---------

- AmebaD [AMB21 / AMB22 / AMB23 / AMB25 / AMB26 / BW16 / AW-CU488 Thing Plus] 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
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -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/image02.png
:width: 598
:height: 318
40 changes: 40 additions & 0 deletions source/_common/ameba_d/Example_Guides/RTC/RTC - Simple RTC.rst
Original file line number Diff line number Diff line change
@@ -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: 426

.. |image02| image:: ../../../../_static/amebad/Example_Guides/RTC/RTC_Simple_RTC/image02.png
:width: 597
:height: 324
Loading