From 5078b163076e2bbb1fb34cf3fb782208457939c2 Mon Sep 17 00:00:00 2001
From: jasionf <2248831014@qq.com>
Date: Fri, 8 Nov 2024 09:35:51 +0800
Subject: [PATCH 1/3] add pinlist wiki
---
.../XIAO_MG24_Pin_Multiplexing.md | 604 ++++++++++++++++++
.../XIAO_RA4M1_Pin_Multiplexing.md | 8 +-
2 files changed, 608 insertions(+), 4 deletions(-)
create mode 100644 docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_MG24/XIAO_MG24_Pin_Multiplexing.md
diff --git a/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_MG24/XIAO_MG24_Pin_Multiplexing.md b/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_MG24/XIAO_MG24_Pin_Multiplexing.md
new file mode 100644
index 000000000000..289d430e1335
--- /dev/null
+++ b/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_MG24/XIAO_MG24_Pin_Multiplexing.md
@@ -0,0 +1,604 @@
+---
+title: Pin Multiplexing with Seeed Studio XIAO MG24
+description: |
+image: https://files.seeedstudio.com/wiki/XIAO_MG24/Pin/top.png
+slug: /xiao_mg24_pin_multiplexing
+keywords:
+ - XIAO
+ - MG24
+last_update:
+ date: 11/6/2024
+ author: Jason
+sidebar_position: 1
+---
+
+
+
+***The XIAO MG24*** features up to ***22 regular pins***, ***18 analog pins***, ***18 digital pins***, ***2 SPI***, ***2 UART***, ***2 I2C***, and supports ***all PWM***. It offers a rich variety of pins available for our use. In this wiki, I will teach you how to drive these pins, enabling us to utilize them effectively 😀!
+
+## Digital
+
+The XIAO MG24(Sense) has up to 22 regular pins , 18 analog pins , 18 Digital, 2xSPI , 2xUART , 2xIIC and ALL PWM.It have a rich variety of pins available for us to use. So in this example, we will use the XIAO MG24
+
+### Hardware Preparation
+
+
+
+ Seeed Studio XIAO MG24 Sense |
+ Seeed Studio Expansion Base for XIAO with Grove OLED |
+ Grove - Relay |
+
+
+ |
+ |
+ |
+
+
+ |
+ |
+ |
+
+
+
+Please install XIAO MG24(Sense) or Sense onto the expansion board, and connect the relay to the **A0/D0** interface of the expansion board via a Grove cable. Finally, connect XIAO to the computer via a USB-C cable.
+
+### Software Implementation
+
+In this example, we will implement control of a relay's on/off state using a button connected to the XIAO expansion board. When the button is pressed, the relay turns on, and when the button is released, the relay turns off.
+
+```c
+const int buttonPin = D1; // the number of the pushbutton pin
+int buttonState = 0; // variable for reading the pushbutton status
+const int relayPin = D0;
+
+void setup() {
+ // initialize the Relay pin as an output:
+ pinMode(relayPin, OUTPUT);
+ // initialize the pushbutton pin as an input:
+ pinMode(buttonPin, INPUT_PULLUP);
+}
+
+void loop() {
+ // read the state of the pushbutton value:
+ buttonState = digitalRead(buttonPin);
+
+ // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
+ if (buttonState == HIGH) {
+ // turn Relay on:
+ digitalWrite(relayPin, HIGH);
+ } else {
+ // turn Relay off:
+ digitalWrite(relayPin, LOW);
+ }
+}
+```
+### Result graph
+
+If everything goes smoothly, after uploading the program, you should see the following effect.
+
+
+
+
+## Digital as PWM
+
+All GPIO pins on XIAO MG24(Sense) support PWM output. Therefore, you can use any pin to output PWM to adjust the brightness of lights, control servos, and other functions.
+
+### Hardware Preparation
+
+
+
+ Seeed Studio XIAO MG24 Sense |
+ Seeed Studio Expansion Base for XIAO with Grove OLED |
+ Grove - Variable Color LED |
+
+
+ |
+ |
+ |
+
+
+ |
+ |
+ |
+
+
+
+:::tip
+Please install XIAO MG24(Sense) or Sense onto the expansion board, then connect the Variable Color LED to the A0/D0 interface of the expansion board using a Grove cable. Finally, connect XIAO to your computer via USB-C cable.
+:::
+
+### Software Implementation
+
+In this example, we will demonstrate how to use PWM output to control the brightness of a light.
+
+```cpp
+int LED_pin = D0; // LED connected to digital pin 10
+
+void setup() {
+ // declaring LED pin as output
+ pinMode(LED_pin, OUTPUT);
+}
+
+void loop() {
+ // fade in from min to max in increments of 5 points:
+ for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 3) {
+ // sets the value (range from 0 to 255):
+ analogWrite(LED_pin, fadeValue);
+ // wait for 30 milliseconds to see the dimming effect
+ delay(30);
+ }
+
+ // fade out from max to min in increments of 5 points:
+ for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 3) {
+ // sets the value (range from 0 to 255):
+ analogWrite(LED_pin, fadeValue);
+ // wait for 30 milliseconds to see the dimming effect
+ delay(30);
+ }
+}
+```
+### Result graph
+
+If the program runs successfully, you will see the following running effect.
+
+
+
+## Analog
+
+XIAO MG24(Sense) Development Board have to 12 bit ADC for high-resolution reading of analog sensor values , it can help us to read more accurate values.
+
+Next , We will choose two sensors to reflect the characteristics of ADC .
+
+### Hadware Preparation
+
+
+
+ Seeed Studio XIAO MG24 Sense |
+ Grove-Variable Color LED |
+ Grove-Rotary Angle Sensor |
+ Seeed Studio Grove Base for XIAO |
+
+
+ |
+ |
+ |
+ |
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+### Software Implementation
+
+``` cpp
+const int analogInPin = D1; // Analog input pin that the potentiometer is attached to
+const int analogOutPin = 9; // Analog output pin that the LED is attached to
+
+int sensorValue = 0; // value read from the pot
+int outputValue = 0; // value output to the PWM (analog out)
+
+void setup() {
+ Serial.begin(115200);
+}
+
+void loop() {
+ sensorValue = analogRead(analogInPin);
+ outputValue = map(sensorValue, 0, 4095, 0, 255);
+ analogWrite(analogOutPin, outputValue);
+
+ Serial.print("sensor = ");
+ Serial.print(sensorValue);
+ Serial.print("\t output = ");
+ Serial.println(outputValue);
+ delay(100);
+}
+```
+### Result graph
+If everything goes smoothly, after uploading the program, you should see the following effect.
+
+
+
+## Serial
+
+When working with Arduino IDE, Serial communication is an essential part of many projects. To
+use Serial in Arduino IDE, you need to start by opening the Serial Monitor window. This can be done by clicking on the **Serial Monitor** icon in the toolbar or by pressing the **Ctrl+Shift+M** shortcut key.
+
+### General Usage
+
+Some of the commonly used Serial functions include:
+
+- `Serial.begin()` -- which initializes the communication at a specified baud rate;
+- `Serial.print()` -- which sends data to the Serial port in a readable format;
+- `Serial.write()` -- which sends binary data to the Serial port;
+- `Serial.available()` -- which checks if there is any data available to be read from the Serial port;
+- `Serial.read()` -- which reads a single byte of data from the Serial port;
+- `Serial.flush()` -- which waits for the transmission of outgoing serial data to complete.
+
+By using these Serial functions, you can send and receive data between the Arduino board and your computer, which opens up many possibilities for creating interactive projects.
+
+Here is an example program:
+
+```c
+void setup() {
+ // initialize serial communication at 9600 bits per second:
+ Serial.begin(9600);
+}
+
+void loop() {
+ // send data to the serial port
+ Serial.println("Hello World!");
+
+ // read data from the serial port
+ if (Serial.available() > 0) {
+ // read the incoming byte:
+ char incomingByte = Serial.read();
+ // print the incoming byte to the serial monitor:
+ Serial.print("I received: ");
+ Serial.println(incomingByte);
+ }
+
+ // wait for a second before repeating the loop
+ delay(1000);
+}
+```
+
+### Usage of Serial1
+
+According to the above XIAO MG24(Sense) Pin diagrams for specific parameters, we can observe that there are TX pin and RX pin.
+This is different from serial communication, but the usage is also very similar, except that a few parameters need to be added.
+So next, we will use the pins led out by the chip for serial communication.
+
+```c
+
+#define BAUD 115200
+
+void setup() {
+ Serial1.begin(BAUD);
+}
+
+void loop() {
+ if(Serial1.available() > 0)
+ {
+ char incominByte = Serial1.read();
+ Serial1.print("I received : ");
+ Serial1.println(incominByte);
+ }
+ delay(1000);
+}
+```
+
+### Usage of Software Serial
+
+```c
+#include
+
+SoftwareSerial mySerial(2, 3); // RX, TX
+
+void setup() {
+ // initialize serial communication
+ Serial.begin(9600);
+ while (!Serial);
+
+ // initialize software serial
+ mySerial.begin(9600);
+}
+
+void loop() {
+ // read data from software serial
+ if (mySerial.available()) {
+ char data = mySerial.read();
+ Serial.print("Received data: ");
+ Serial.println(data);
+ }
+
+ // write data to software serial
+ mySerial.print("Hello World!");
+
+ // wait for a second before repeating the loop
+ delay(1000);
+}
+```
+
+In this program, we first include the `SoftwareSerial.h` library to use software serial. Then, we create a new SoftwareSerial object called mySerial using pins 2 and 3 as RX and TX, respectively.
+
+In the `setup()` function, we initialize both the hardware serial (`Serial.begin()`) and the software serial (`mySerial.begin()`).
+
+In the `loop()` function, we use the `mySerial.available()` function to check if there is any data available to be read from the software serial. If there is, we read the incoming byte using the `mySerial.read()` function and store it in a variable called data. We then use the `Serial.print()` and `Serial.println()` functions to print "Received data: " followed by the value of data to the hardware serial.
+
+We also use the `mySerial.print()` function to write "Hello World!" to the software serial. This will send the data from the XIAO to the device connected to the software serial port.
+
+Finally, we add a `delay()` function to wait for one second before repeating the loop.
+
+## IIC
+
+XIAO MG24(Sense) has an I2C interface that can be used for data transmission and parsing of many sensors, as well as for using some OLED screens.
+
+### Harware Preparation
+
+
+
+ Seeed Studio XIAO MG24 Sense |
+ Seeed Studio Expansion Base for XIAO with Grove OLED |
+
+
+ |
+ |
+
+
+ |
+ |
+
+
+
+The OLED display on the XIAO expansion board uses the I2C protocol and is connected to the XIAO's I2C interface through the I2C circuit on the board. Therefore, we can directly plug the XIAO into the expansion board and program it to display content on the screen.
+
+### Software Implementation
+
+This example introduces how to use the OLED display on the Seeed Studio Expansion Base for XIAO MG24(Sense).
+
+***Step 1. Install the Seeed Studio XIAO MG24(Sense) on the Expansion board then conect the Type-C cable.***
+
+*** Step 2. Install the u8g2 library.***
+
+
+
+*** Step 3. Copy the code and stick on the Ardiono IDE then upload it.***
+- Download the zip file below
+
+📄 **[ZIP]** [smiley_face Header](https://files.seeedstudio.com/wiki/XIAO_MG24/Pin/smiley_face.zip)
+
+- Create a header file named "smiley_face. h" and copy the contents of the downloaded zip file into the header file you created
+
+
+```c
+#include
+#include
+#include
+#include "smiley_face.h"
+
+U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
+
+int xx = 20;
+int yy = 10;
+
+void setup() {
+ u8g2.begin();
+}
+
+void loop() {
+ smeil_display();
+ delay(500);
+}
+
+void smeil_display() {
+ const unsigned char* smileImages[] = {
+ semil1, semil2, semil3, semil4, semil5,
+ semil6, semil7, semil8, semil9, semil10,
+ semil11, semil12, semil13, semil14, semil15,
+ semil16, semil17, semil18, semil19, semil20,
+ semil21, semil22, semil23, semil24, semil25,
+ semil26, semil27
+ };
+
+ int delays[] = {
+ 40, 50, 40, 40, 40,
+ 40, 40, 50, 40, 40,
+ 40, 40, 40, 50, 40,
+ 40, 50, 40, 40, 50,
+ 40, 50, 40, 40, 50,
+ 50, 50, 40, 50
+ };
+
+ for (int i = 0; i < sizeof(smileImages) / sizeof(smileImages[0]); i++) {
+ u8g2.firstPage();
+ do {
+ u8g2.drawXBMP(xx, yy, 48, 48, smileImages[i]);
+ } while (u8g2.nextPage());
+ delay(delays[i]);
+ }
+}
+}
+```
+
+### Result graph
+
+
+
+## SPI
+
+The XIAO MG24(Sense) chip integrates multiple peripherals, including an SPI interface that can be used to connect external SPI devices such as flash memory, displays, sensors, and more.
+
+### Arduino Library Overview
+
+:::tip
+If this is your first time using Arduino, we highly recommend you to refer to [Getting Started with Arduino](https://wiki.seeedstudio.com/Getting_Started_with_Arduino/).
+:::
+
+
+
+Based on the Arduino example program provided by **Waveshare**, we have written an Arduino library for use with the entire XIAO series, and you can go straight to the Github for this library via the button below.
+
+### Hadware Preparation
+
+
+
+
+ Seeed Studio XIAO MG24 Sense |
+ 1.69-inch LCD SPI Display |
+
+
+ |
+ |
+
+
+ |
+ |
+
+
+
+
+### Pin Connect
+
+
+After preparing the hardware as mentioned above, use jumper wires to connect the SPI interface of the XIAO and OLED. Please refer to the following diagram for the wiring method.
+
+
+### Installation
+
+Since you have downloaded the zip Library, open your Arduino IDE, click on **Sketch > Include Library > Add .ZIP Library**. Choose the zip file you just downloaded,and if the library install correct, you will see **Library added to your libraries** in the notice window. Which means the library is installed successfully.
+
+
+
+
+### Software Implementation
+
+After downloading and installing the library correctly, you can find two example programs named **helloworld.ino** and **bgcolor.ino** in the examples folder. The bgcolor.ino is an example to show the background color, we set the red as default. And the helloworld.ino is an to show the animation about our company logo, and this example contains the effect which the bgcolor example have.
+
+```cpp
+#include
+#include "SPI.h"
+#include "seeed.h"
+
+st7789v2 Display;
+
+void setup() {
+ // put your setup code here, to run once:
+ Display.SetRotate(270);
+ Display.Init();
+ Display.SetBacklight(100);
+ Display.Clear(WHITE);
+}
+
+void loop() {
+ // put your main code here, to run repeatedly:
+// Display.SetPixel(100, 100, RED);
+// Display.DrawPoint(50, 50, YELLOW, DOT_PIXEL_8X8, DOT_FILL_AROUND);
+
+ Display.DrawImage(gImage_seeed, 20, 90, 240, 47);
+
+ Display.DrawLine(15, 65, 65, 65, MAGENTA, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
+ Display.DrawLine(15, 70, 80, 70, MAGENTA, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
+
+ Display.DrawRectangle(15, 80, 265, 150, GRAY, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
+
+ Display.DrawCircle(10, 10, 25, BLUE, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
+ Display.DrawCircle(10, 10, 20, BLACK, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
+ Display.DrawCircle(10, 10, 15, RED, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
+ Display.DrawCircle(10, 10, 10, GREEN, DOT_PIXEL_2X2, DRAW_FILL_FULL);
+
+ Display.DrawCircle(270, 10, 25, BLUE, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
+ Display.DrawCircle(270, 10, 20, BLACK, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
+ Display.DrawCircle(270, 10, 15, RED, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
+ Display.DrawCircle(270, 10, 10, GREEN, DOT_PIXEL_2X2, DRAW_FILL_FULL);
+
+ Display.DrawCircle(10, 230, 25, BLUE, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
+ Display.DrawCircle(10, 230, 20, BLACK, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
+ Display.DrawCircle(10, 230, 15, RED, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
+ Display.DrawCircle(10, 230, 10, GREEN, DOT_PIXEL_2X2, DRAW_FILL_FULL);
+
+ Display.DrawCircle(270, 230, 25, BLUE, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
+ Display.DrawCircle(270, 230, 20, BLACK, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
+ Display.DrawCircle(270, 230, 15, RED, DOT_PIXEL_2X2, DRAW_FILL_EMPTY);
+ Display.DrawCircle(270, 230, 10, GREEN, DOT_PIXEL_2X2, DRAW_FILL_FULL);
+
+ Display.DrawLine(200, 160, 265, 160, GRAYBLUE, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
+ Display.DrawLine(215, 165, 265, 165, GRAYBLUE, DOT_PIXEL_2X2, LINE_STYLE_SOLID);
+
+ Display.DrawString_EN(20, 180, "By: Jason", &Font20, WHITE, BLACK);
+// Display.DrawNum(100, 220, 123456, &Font24, RED, BRED);
+ Display.DrawFloatNum(100, 210, 1.00, 2, &Font16, WHITE, BLACK);
+}
+```
+
+You will find Seeed Studio logo printed on the display dynamically.
+
+
+
+## Finish up
+You have learned the basic functions of the XIAO MG24 (Sense) pins. Now, let's further explore the built-in sensors.
+
+
+
+## Tech Support & Product Discussion
+
+Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.
+
+
+
+
+
diff --git a/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_RA4M1/XIAO_RA4M1_Pin_Multiplexing.md b/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_RA4M1/XIAO_RA4M1_Pin_Multiplexing.md
index 9006245d8fd1..567c08fbd82c 100644
--- a/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_RA4M1/XIAO_RA4M1_Pin_Multiplexing.md
+++ b/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_RA4M1/XIAO_RA4M1_Pin_Multiplexing.md
@@ -161,7 +161,7 @@ If the program runs successfully, you will see the following running effect.
## Analog
-XIAO RA4M1 Development Board Having up to 14 bit ADC for high-resolution reading of analog sensor values , it can help us to read more accurate values . The analog-to-digital converter(ADC) on an XIAO RA4M1 Development board . By Default , the resolution is set 10-bit , which can be to both 12-bit and 14-bit resolution for improved accuracy on analog readings
+XIAO RA4M1 Development Board Having up to 14 bit ADC for high-resolution reading of analog sensor values , it can help us to read more accurate val The analog-to-digital converter(ADC) on an XIAO RA4M1 Development board . By Default , the resolution is set 10-bit , which can be to both 12-bit and 14-bit resolution for improved accuracy on analog readings
Detail Datas by ADC accuracy
- 10-bit : 0~1024
@@ -177,12 +177,12 @@ Next , We will choose two sensors to reflect the characteristics of ADC .
Seeed Studio XIAO RA4M1 |
Grove-Variable Color LED |
Grove-Rotary Angle Sensor |
- Grove-Rotary Angle Sensor |
+ Seeed Studio Grove Base for XIAO |
|
+ |
|
- |
|
@@ -213,7 +213,7 @@ Next , We will choose two sensors to reflect the characteristics of ADC .
### Software Implementation
``` cpp
-#define ADC_Bit_Fourteen 14
+#define ADC_Bit_Fourteen 14ues .
#define ADC_Bit_Twelve 12
#define ADC_Bit_Ten 10
From e30439e1bf23aae0e9df514927b23c361280e568 Mon Sep 17 00:00:00 2001
From: jasionf <2248831014@qq.com>
Date: Fri, 8 Nov 2024 09:52:51 +0800
Subject: [PATCH 2/3] add description
---
.../SeeedStudio_XIAO_MG24/XIAO_MG24_Pin_Multiplexing.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_MG24/XIAO_MG24_Pin_Multiplexing.md b/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_MG24/XIAO_MG24_Pin_Multiplexing.md
index 289d430e1335..2eb185ee4d0a 100644
--- a/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_MG24/XIAO_MG24_Pin_Multiplexing.md
+++ b/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_MG24/XIAO_MG24_Pin_Multiplexing.md
@@ -1,13 +1,13 @@
---
title: Pin Multiplexing with Seeed Studio XIAO MG24
-description: |
+description: Pin multiplexing with Seeed Studio XIAO MG24(Sense).
image: https://files.seeedstudio.com/wiki/XIAO_MG24/Pin/top.png
slug: /xiao_mg24_pin_multiplexing
keywords:
- XIAO
- MG24
last_update:
- date: 11/6/2024
+ date: 11/6/2024
author: Jason
sidebar_position: 1
---
From aa69f5ab51a2a98fc572edee2a5eb66a69040bc0 Mon Sep 17 00:00:00 2001
From: jasionf <2248831014@qq.com>
Date: Fri, 8 Nov 2024 09:58:09 +0800
Subject: [PATCH 3/3] ra4m1 txt
---
.../SeeedStudio_XIAO_RA4M1/XIAO_RA4M1_Pin_Multiplexing.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_RA4M1/XIAO_RA4M1_Pin_Multiplexing.md b/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_RA4M1/XIAO_RA4M1_Pin_Multiplexing.md
index 567c08fbd82c..98bd736a7221 100644
--- a/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_RA4M1/XIAO_RA4M1_Pin_Multiplexing.md
+++ b/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_RA4M1/XIAO_RA4M1_Pin_Multiplexing.md
@@ -213,7 +213,7 @@ Next , We will choose two sensors to reflect the characteristics of ADC .
### Software Implementation
``` cpp
-#define ADC_Bit_Fourteen 14ues .
+#define ADC_Bit_Fourteen 14
#define ADC_Bit_Twelve 12
#define ADC_Bit_Ten 10