Skip to content

I2C Example Guide Structure Fix #9

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 1 commit into from
Oct 2, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Example
-------

Introduction
------------
~~~~~~~~~~~~

Normally there are many pins on an LCD display, as shown below.

Expand All @@ -26,23 +26,23 @@ An LCD display can be equipped with an additional processing chip to process the
using the I2C interface.

Procedure
---------
~~~~~~~~~

**AMB82 Mini** wiring diagram:

|image02|

| Open the example in File -> Examples -> AmebaWire -> LCD_HelloWorld.
| Open the example in "File" -> "Examples" -> "AmebaWire" -> "LCD_HelloWorld".
| Compile and upload to Ameba, then press the reset button.
| You can now see Hello World in the first line, and Ameba in the second line displayed on the LCD screen.
| You can now see "Hello World" in the first line, and "Ameba" in the second line displayed on the LCD screen.

|image03|

After 8 seconds, you can input to the Serial Monitor the string you would like to display on the LCD.

|image04|

For example, we enter 123456789 and press Send:
For example, we enter "123456789" and press "Send":

|image05|

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Example
-------

Introduction
------------
~~~~~~~~~~~~

This example will demonstrate getting the data from MPU6050 with DMP6.
MPU6050 is equipped with a Digital Motion Processor (DMP) to handle the
Expand All @@ -27,13 +27,13 @@ acceleration, adjusted to remove gravity, and rotated based on known
orientation from quaternion.

Procedure
---------
~~~~~~~~~

Connect the MPU6050 to I2C_SDA and I2C_SCL of the board as shown in the diagram below.

|image01|

Open the example in File -> Examples -> AmebaWire -> MPU6050-> MPU6050_DMP6_ImuData_for_ROS.ino.
Open the example in "File" -> "Examples" -> "AmebaWire" -> "MPU6050"-> "MPU6050_DMP6_ImuData_for_ROS.ino".

|image02|

Expand Down
6 changes: 3 additions & 3 deletions source/amebapro2/Example_Guides/I2C/MPU6050 DMP6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Example
-------

Introduction
------------
~~~~~~~~~~~~

This example will demonstrate getting the data from MPU6050 with DMP6.
MPU6050 is equipped with a Digital Motion Processor (DMP) to handle the
Expand All @@ -33,14 +33,14 @@ For MPU6050_DMP6.ino, the DMP library version is 2.0. For
MPU6050_DMP6_using_DMP_V6v12.ino, the DMP library version is 6.12.

Procedure
---------
~~~~~~~~~

Connect the MPU6050 to I2C_SDA and I2C_SCL of the board as shown in the
diagram below.

|image01|

Open the example in File -> Examples -> AmebaWire -> MPU6050-> MPU6050_DMP6 OR MPU6050_DMP6_using_DMP_V6v12
Open the example in "File" -> "Examples" -> "AmebaWire" -> "MPU6050"-> "MPU6050_DMP6" OR "MPU6050_DMP6_using_DMP_V6v12"

|image02|

Expand Down
6 changes: 3 additions & 3 deletions source/amebapro2/Example_Guides/I2C/MPU6050 IMU Zero.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ Example
-------

Introduction
------------
~~~~~~~~~~~~

This example will demonstrate how to do calibration for the MPU6050 IMU.

Procedure
---------
~~~~~~~~~

Connect the MPU6050 to I2C_SDA and I2C_SCL of the board as shown in the diagram below.

|image01|

Open the example in File -> Examples -> AmebaWire -> MPU6050-> MPU6050_IMU_Zero
Open the example in "File" -> "Examples" -> "AmebaWire" -> "MPU6050"-> "MPU6050_IMU_Zero"

|image02|

Expand Down
6 changes: 3 additions & 3 deletions source/amebapro2/Example_Guides/I2C/MPU6050 Raw Data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ Example
-------

Introduction
------------
~~~~~~~~~~~~

This example will demonstrate getting the raw data from MPU6050.

Procedure
---------
~~~~~~~~~

Connect the MPU6050 to I2C_SDA and I2C_SCL of the board as shown in the diagram below.

|image01|

Open the example in File -> Examples -> AmebaWire -> MPU6050-> MPU6050_raw.
Open the example in "File" -> "Examples" -> "AmebaWire" -> "MPU6050"-> "MPU6050_raw".

|image02|

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,44 @@ Materials
Example
-------

Introduction of I2C
-------------------
I2C Introduction
~~~~~~~~~~~~~~~~

There are two roles in the operation of I2C, one is master, the other
is slave. Only one master is allowed and can be connected to many
There are two roles in the operation of I2C, one is "master", the other
is "slave". Only one master is allowed and can be connected to many
slaves. Each slave has its unique address, which is used in the
communication between master and the slave. I2C uses two pins, one is
for data transmission (SDA), the other is for the clock (SCL). Master
uses the SCL to inform slave of the upcoming data transmission, and the
data is transmitted through SDA. The I2C example was named Wire in the
data is transmitted through SDA. The I2C example was named "Wire" in the
Arduino example.

Introduction
------------
~~~~~~~~~~~~

In the example "I2C - Send Data to Arduino Uno", Ameba, the I2C master, transmits data to the Arduino UNO, the I2C slave.
As to this example, Ameba is the I2C master, and receives data from the Arduino UNO, which is the I2C slave.

Procedure
---------
~~~~~~~~~

- **Setting up Arduino Uno to be I2C Slave**

| First, select Arduino in the Arduino IDE in Tools -> Board -> Arduino Uno:
| Open Examples -> Wire -> slave_sender
| First, select Arduino in the Arduino IDE in "Tools" -> "Board" -> "Arduino Uno":
| Open "Examples" -> "Wire" -> "slave_sender"

|image01|

Then click Sketch -> Upload to compile and upload the example to Arduino Uno.
Then click "Sketch" -> "Upload" to compile and upload the example to Arduino Uno.

- **Setting up Ameba to be I2C Master**

| Next, open another window of Arduino IDE, make sure to choose your Ameba development board in the IDE: Tools -> Board
| Open File -> Examples -> AmebaWire -> MasterReceiveData
| Next, open another window of Arduino IDE, make sure to choose your Ameba development board in the IDE: "Tools" -> "Board"
| Open "File" -> "Examples" -> "AmebaWire" -> "MasterReceiveData"

|image02|

Click Sketch -> Upload to compile and upload the example to Ameba.
Click "Sketch" -> "Upload" to compile and upload the example to Ameba.

- **Wiring**

Expand All @@ -66,16 +66,16 @@ Click “Sketch” -> “Upload” to compile and upload the example to Ameba.
| Next, we will observe the data receive by Ameba in the Serial Monitor.
| (Note: If you do not know which port the Ameba development board is
connected to, please find it in the Device Manager of Windows first.
Ameba is connected as mbed Serial Port. For example, if you find
Ameba is connected as "mbed Serial Port". For example, if you find
mbed Serial Port (COM15) means Ameba is connected to port COM15.)

|image04|

| We select the port in Tools -> Port -> COM15 (the port connected to Ameba)
| Open the Arduino IDE window of the Ameba, go to Tools -> Serial Monitor to display the messages printed by Ameba.
| We select the port in "Tools" -> "Port" -> "COM15" (the port connected to Ameba)
| Open the Arduino IDE window of the Ameba, go to "Tools" -> "Serial Monitor" to display the messages printed by Ameba.
| Press the reset button on Arduino Uno, Arduino Uno now waits for connection from I2C master.
| Then press the reset button on Ameba, Ameba will start to receive
messages from Arduino Uno. And you can see the hello message
messages from Arduino Uno. And you can see the "hello" message
printed every half second in serial monitor.
| (NOTE: If the message does not show in the Serial Monitor of Ameba,
please close and open the serial monitor again.)
Expand All @@ -88,10 +88,10 @@ Code Reference
| You can find detailed information of this example in the documentation of Arduino:
| https://www.arduino.cc/en/Tutorial/MasterReader

| First use Wire.begin()/Wire.begin(address) to join the I2C bus as a master or slave, in the Master case the address is not required.
| First use ``Wire.begin()`` / ``Wire.begin(address)`` to join the I2C bus as a master or slave, in the Master case the address is not required.
| https://www.arduino.cc/en/Reference/WireBegin

| Next, the Master uses Wire.requestFrom() to specify from which Slave to request data.
| Next, the Master uses ``Wire.requestFrom()`` to specify from which Slave to request data.
| https://www.arduino.cc/en/Reference/WireRequestFrom

.. |image01| image:: ../../../_static/amebapro2/Example_Guides/I2C/Master_Receive_Data_from_Arduino_UNO/image01.png
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,23 @@ Materials

- Arduino UNO x 1


Example
-------

Introduction of I2C
-------------------
I2C Introduction
~~~~~~~~~~~~~~~~

There are two roles in the operation of I2C, one is master, the other
is slave. Only one master is allowed and can be connected to many
There are two roles in the operation of I2C, one is "master", the other
is "slave". Only one master is allowed and can be connected to many
slaves. Each slave has its unique address, which is used in the
communication between master and the slave. I2C uses two pins, one is
for data transmission (SDA), the other is for the clock (SCL). Master
uses the SCL to inform slave of the upcoming data transmission, and the
data is transmitted through SDA. The I2C example was named Wire in the
data is transmitted through SDA. The I2C example was named "Wire" in the
Arduino example.

Introduction
------------
~~~~~~~~~~~~

In this example, we use Ameba as the I2C master writer, and use Arduino
as the I2C slave receiver.
Expand All @@ -38,21 +37,21 @@ When the I2C slave receives string sent from I2C master, it prints the
received string.

Procedure
---------
~~~~~~~~~

- **Setting up Arduino Uno to be I2C Slave**

| First, select Arduino in the Arduino IDE in Tools -> Board -> Arduino Uno
| Open the Slave Receiver example in Examples -> Wire -> slave_receiver:
| First, select Arduino in the Arduino IDE in "Tools" -> "Board" -> "Arduino Uno"
| Open the "Slave Receiver" example in "Examples" -> "Wire" -> "slave_receiver":

|image01|

Then click Sketch -> Upload to compile and upload the example to Arduino Uno.
Then click "Sketch" -> "Upload" to compile and upload the example to Arduino Uno.

- Setting up Ameba to be I2C Master
- **Setting up Ameba to be I2C Master**

| Next, open another window of Arduino IDE, make sure to choose your Ameba development board in the IDE: Tools -> Board
| Then open the Master Writer example in File -> Examples -> AmebaWire -> MasterSendData
| Next, open another window of Arduino IDE, make sure to choose your Ameba development board in the IDE: "Tools" -> "Board"
| Then open the "Master Writer" example in "File" -> "Examples" -> "AmebaWire" -> "MasterSendData"

|image02|

Expand All @@ -65,7 +64,7 @@ Then click “Sketch” -> “Upload” to compile and upload the example to Ard

|image03|

| Open the Arduino IDE of the Arduino Uno and open the serial monitor (Tools -> Serial Monitor).
| Open the Arduino IDE of the Arduino Uno and open the serial monitor ("Tools" -> "Serial Monitor").
| In the Serial Monitor, you can see the messages printed from Arduino Uno.
| Next, press the reset button on Arduino Uno. Now the Arduino Uno is waiting for the connection from I2C Master.
| We press the reset button on Ameba to start to send messages. Then observe the serial monitor, you can see the messages show up every half second.
Expand All @@ -78,13 +77,13 @@ Code Reference
| You can find detailed information of this example in the documentation of Arduino:
| https://www.arduino.cc/en/Tutorial/MasterWriter

| First use Wire.begin()/Wire.begin(address) to join the I2C bus as a master or slave, in the Master case the address is not required.
| First use ``Wire.begin()`` / ``Wire.begin(address)`` to join the I2C bus as a master or slave, in the Master case the address is not required.
| https://www.arduino.cc/en/Reference/WireBegin

| Next, the Master uses Wire.beginTransmission(address) to begin a transmission to the I2C slave with the given address:
| Next, the Master uses ``Wire.beginTransmission(address)`` to begin a transmission to the I2C slave with the given address:
| https://www.arduino.cc/en/Reference/WireBeginTransmission

| Uses Wire.write() to send data, and finally use Wire.endTransmission() to end a transmission to a Slave and transmits the bytes that were queued:
| Uses ``Wire.write()`` to send data, and finally use ``Wire.endTransmission()`` to end a transmission to a Slave and transmits the bytes that were queued:
| https://www.arduino.cc/en/Reference/WireEndTransmission

.. |image01| image:: ../../../_static/amebapro2/Example_Guides/I2C/Master_Send_Data_to_Arduino_UNO/image01.png
Expand Down
12 changes: 6 additions & 6 deletions source/amebapro2/Example_Guides/I2C/OLED Display.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ Example
-------

Introduction
------------
~~~~~~~~~~~~

The example will showcase texts, shapes, and bitmap images on an OLED
display using the I2C communication protocol alongside Adafruit
libraries.

Procedure
---------
~~~~~~~~~

Connect the 0.96-inch OLED display to I2C_SDA and I2C_SCL of the board.

|image01|

Open the example in File -> Examples -> AmebaWire -> OLED_SSD1306.
Open the example in "File" -> "Examples" -> "AmebaWire" -> "OLED_SSD1306".

|image02|

For this example, we will be using 0x3D as the address.

|image03|

If the address doesnt work for you, you can run I2CScanner to find the
OLED address by navigating to File -> Examples -> AmebaWire ->
I2CScanner.
If the address doesn't work for you, you can run I2CScanner to find the
OLED address by navigating to "File" -> "Examples" -> "AmebaWire" ->
"I2CScanner".

|image04|

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Example
-------

Introduction
------------
~~~~~~~~~~~~

This example will illustrate how to retrieve the value of VL53L0X IR
sensor and pass it to the AMB82-Mini board. VL53L0X Distance Sensor is a
Expand All @@ -29,17 +29,17 @@ has pretty low power consumption.
| 2) Single.ino

Procedure
---------
~~~~~~~~~

Connect the VL53L0X IR sensor to I2C_SDA and I2C_SCL of the board as shown in the diagram below.

|image01|

Open the example in File -> Examples -> AmebaWire -> VL53L0X -> Continuous OR Single.
Open the example in "File" -> "Examples" -> "AmebaWire" -> "VL53L0X" -> "Continuous" OR "Single".

|image02|

You will choose Single if you want to get single-shot range
You will choose "Single" if you want to get single-shot range
measurements from the VL53L0X sensor. The sensor can be optionally be
configured with different ranging profiles to get better performance for
a certain application.
Expand Down
Loading
Loading