From 0a90da6e951753d72d1ba9aa0202cd726d8f26f7 Mon Sep 17 00:00:00 2001 From: Spencer Yan Date: Mon, 23 Sep 2024 11:08:57 +0800 Subject: [PATCH 1/2] chore(Grove-Gesture_v1.0.md): revised layout --- .../Proximity/Grove-Gesture_v1.0.md | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/docs/Sensor/Grove/Grove_Sensors/Proximity/Grove-Gesture_v1.0.md b/docs/Sensor/Grove/Grove_Sensors/Proximity/Grove-Gesture_v1.0.md index 2f105569c222..dd4931858ce9 100755 --- a/docs/Sensor/Grove/Grove_Sensors/Proximity/Grove-Gesture_v1.0.md +++ b/docs/Sensor/Grove/Grove_Sensors/Proximity/Grove-Gesture_v1.0.md @@ -7,19 +7,28 @@ keywords: image: https://wiki.seeedstudio.com/Grove-Gesture_v1.0/ slug: /Grove-Gesture_v1.0 last_update: - date: 01/05/2022 + date: 09/23/2024 author: gunengyu --- -![](https://files.seeedstudio.com/wiki/Grove_Gesture_V_1.0/img/400px-Gesture_sensor_3.png) +
+ +
+ +
+ + Get One Now 🖱️ + +


The sensor on Grove - Gesture is PAJ7620U2 that integrates gesture recognition function with general I2C interface into a single chip. It can recognize 9 basic gestures, and these gestures information can be simply accessed via the I2C bus. Application: You can use Gesture as an input device to control another grove, or a computer, mobile phone, smart car, robot, and more with a simple swipe of your hand. - ## Features @@ -106,7 +115,7 @@ Software Installation. - **Step 4.** Start the Arduino IDE, Let's try the up/down demo. - **Step 5.** Copy below code and paste to arduino IDE. -```cpp +```cpp showLineNumbers /* The following simple demo will show you a very easy application: When you move up, the red led will be turned on, otherwise the red led will be turned off. */ @@ -138,7 +147,7 @@ void loop() - **Step 8.** Let's try the 9 gestures by select **File->Example->Grove_Gesture->paj7620_9gestures**, then select Seeeduino v4 as board manager and correct COM port. -```cpp +```cpp title="paj7620_9gestures" showLineNumbers #include #include "paj7620.h" @@ -281,7 +290,7 @@ void loop() - **Step 9.** Click upload and open the Serial Monitor port. - **Step 10.** This example can recognize 9 gestures and output the result, including move up, move down, move left, move right, move forward, move backward, circle-clockwise, circle-counter clockwise, and wave. Let's try and see COM port output as below. -```cpp +```shell PAJ7620U2 TEST DEMO: Recognize 9 gestures. INIT SENSOR... Addr0 =20, Addr1 =76 @@ -360,24 +369,21 @@ Upload the program to your Arduino/Seeeduino. - **Step 1**. Follow [Setting Software](https://wiki.seeedstudio.com/Grove_Base_Hat_for_Raspberry_Pi/#installation) to configure the development environment. - **Step 2**. Download the source file by cloning the grove.py library. -``` +```shell cd ~ git clone https://github.com/Seeed-Studio/grove.py - ``` - **Step 3**. Excute below commands to run the code. -``` +```shell cd grove.py/grove python3 grove_gesture_sensor.py - ``` Following is the grove_gesture_sensor.py code. -```python - +```python title="grove_gesture_sensor.py" showLineNumbers import time,sys import RPi.GPIO as GPIO from grove.i2c import Bus @@ -900,8 +906,7 @@ if __name__ == "__main__": If everything goes well, you will be able to see the following result ::: -```python - +```shell pi@raspberrypi:~/grove.py/grove $ python3 grove_gesture_sensor.py wake-up finish. Paj7620 initialize register finished. @@ -912,12 +917,6 @@ Backward Right Up Down -^CTraceback (most recent call last): - File "grove_gesture_sensor.py", line 555, in - time.sleep(.1) -KeyboardInterrupt - - ``` You can quit this program by simply press ++ctrl+c++. @@ -962,7 +961,7 @@ python3 gesture_value.py Here is the code of gesture_value.py -```Python +```python #!/usr/bin/env python # # GrovePi Example for using the Grove - Gesture Sensor v1.0(https://www.seeedstudio.com/depot/Grove-Gesture-p-2463.html) @@ -1030,7 +1029,7 @@ while True: - **Step 4.** Here is the screen output. -```cpp +```cpp showLineNumbers pi@raspberrypi:~/Dexter/GrovePi/Software/Python/grove_gesture_sensor $ python3 gesture_value.py wake-up finish. Paj7620 initialize register finished. From a8c4666cb8988072167dc91778e9866af6f82db3 Mon Sep 17 00:00:00 2001 From: Spencer Yan Date: Mon, 23 Sep 2024 11:10:16 +0800 Subject: [PATCH 2/2] chore: change ```Python to ```python --- docs/Seeed_Elderly/Artik/Eagleye_530s.md | 8 ++++---- .../reSpeaker/Extension Board/ReSpeaker_Mic_Array.md | 6 +++--- .../Extension Board/ReSpeaker_Mic_Array_v2.0.md | 10 +++++----- .../Seeed_Elderly/reSpeaker/ReSpeaker-USB-Mic-Array.md | 10 +++++----- ...peaker_6-Mic_Circular_Array_kit_for_Raspberry_Pi.md | 6 +++--- .../Sensors/Gear_Stepper_Motor_Driver_Pack.md | 2 +- .../Current/Grove-Electricity_Sensor.md | 2 +- docs/Sensor/Grove/Grove_Accessories/Time/Grove-RTC.md | 2 +- .../Grove-6-Axis_AccelerometerAndCompass_V2.0.md | 2 +- .../Barometer/Grove-Barometer-High-Accuracy.md | 2 +- .../Grove/Grove_Sensors/Gas/Grove-Gas_Sensor-MQ2.md | 4 ++-- .../Grove/Grove_Sensors/Light/Grove-Flame_Sensor.md | 2 +- .../Grove/Grove_Sensors/Light/Grove-Sunlight_Sensor.md | 2 +- .../Temperature/One-Wire-Temperature-Sensor-DS18B20.md | 2 +- .../Grove/Grove_Sensors/Touch/Grove-Touch_Sensor.md | 2 +- .../SeeedStudio_XIAO_SAMD21/XIAO-SAMD21-MicroPython.md | 8 ++++---- .../Application/XIAO_BLE_HA.md | 2 +- .../Grove_Sensor/Light/_Grove-Flame_Sensor_Spanish.md | 2 +- .../Grove_Sensor/Touch/_Grove-Touch_Sensor_Spanish.md | 2 +- .../Compiling_MicroPython_for_embedded_devices.md | 2 +- .../Pi_HAT/RS-485_Shield_for_Raspberry_Pi.md | 4 ++-- .../reSpeaker/ReSpeaker_Mic_Array_v2.0.md | 10 +++++----- .../Current/cn-Grove-Electricity_Sensor.md | 2 +- .../Grove/Grove_Accessories/Time/cn-Grove-RTC.md | 2 +- .../CN_XIAO-SAMD21-MicroPython.md | 8 ++++---- .../Application/CN_XIAO_BLE_HA.md | 2 +- 26 files changed, 53 insertions(+), 53 deletions(-) diff --git a/docs/Seeed_Elderly/Artik/Eagleye_530s.md b/docs/Seeed_Elderly/Artik/Eagleye_530s.md index 4c2241834aa0..3228fc01f455 100644 --- a/docs/Seeed_Elderly/Artik/Eagleye_530s.md +++ b/docs/Seeed_Elderly/Artik/Eagleye_530s.md @@ -865,7 +865,7 @@ For more information, such as play with Alexa/DuerOS, please refer to [ReSpeaker - Start recording using the Command Line -```Python +```python arecord -D plughw:1,0 -f cd test.wav # record, please use the arecord -l to check the card and hardware first aplay -D plughw:1,0 -f cd test.wav # play, please use the aplay -l to check the card and hardware first arecord -D plughw:1,0 -f cd |aplay -D plughw:1,0 -f cd # record and play at the same time @@ -875,7 +875,7 @@ arecord -D plughw:1,0 -f cd |aplay -D plughw:1,0 -f cd # record and play at the - Step 1, We need to run the following script to get the device index number of Mic Array: - ```Python + ```python apt install python-pip pip install pyaudio cd ~ @@ -884,7 +884,7 @@ arecord -D plughw:1,0 -f cd |aplay -D plughw:1,0 -f cd # record and play at the - Step 2, copy below code and paste on [get_index.py](https://files.seeedstudio.com/wiki/Eagleye_530s/res/get_index.py). -```Python +```python import pyaudio p = pyaudio.PyAudio() @@ -910,7 +910,7 @@ Input Device id 8 - default - Step 5, change `RESPEAKER_INDEX = 2` to index number. Run python script [record.py](https://files.seeedstudio.com/wiki/Eagleye_530s/res/record.py) to record a speech. -```Python +```python import pyaudio import wave diff --git a/docs/Seeed_Elderly/reSpeaker/Extension Board/ReSpeaker_Mic_Array.md b/docs/Seeed_Elderly/reSpeaker/Extension Board/ReSpeaker_Mic_Array.md index a6eefd3072e5..fa420c674b37 100644 --- a/docs/Seeed_Elderly/reSpeaker/Extension Board/ReSpeaker_Mic_Array.md +++ b/docs/Seeed_Elderly/reSpeaker/Extension Board/ReSpeaker_Mic_Array.md @@ -82,7 +82,7 @@ Here is an example also based on Pyaudio: First, you need to run the following script to get the device index number of Mic Array: -```Python +```python import pyaudio p = pyaudio.PyAudio() @@ -96,7 +96,7 @@ for i in range(0, numdevices): Then, change `RESPEAKER_INDEX = 1` to your index number. Run the script to record a speech. -```Python +```python import pyaudio import wave @@ -158,7 +158,7 @@ Note that if you are using the lastest *raw version*, you could only control the And here is an python example : -```Python +```python #!/usr/bin/env python import respeaker.usb_hid as usb_hid diff --git a/docs/Seeed_Elderly/reSpeaker/Extension Board/ReSpeaker_Mic_Array_v2.0.md b/docs/Seeed_Elderly/reSpeaker/Extension Board/ReSpeaker_Mic_Array_v2.0.md index 5b48846cc801..000c4d048f0a 100644 --- a/docs/Seeed_Elderly/reSpeaker/Extension Board/ReSpeaker_Mic_Array_v2.0.md +++ b/docs/Seeed_Elderly/reSpeaker/Extension Board/ReSpeaker_Mic_Array_v2.0.md @@ -308,7 +308,7 @@ cd pixel_ring/pixel_ring - Step 2. Create a [led_control.py](https://files.seeedstudio.com/wiki/ReSpeaker_Mic_Array_V2/res/led_control.py) with below code and run 'python led_control.py' -```Python +```python from usb_pixel_ring_v2 import PixelRing import usb.core import usb.util @@ -441,7 +441,7 @@ We use [PyAudio python library](https://people.csail.mit.edu/hubert/pyaudio/) to **For Linux:** We can use below commands to record or play the voice. -```Python +```python arecord -D plughw:1,0 -f cd test.wav # record, please use the arecord -l to check the card and hardware first aplay -D plughw:1,0 -f cd test.wav # play, please use the aplay -l to check the card and hardware first arecord -D plughw:1,0 -f cd |aplay -D plughw:1,0 -f cd # record and play at the same time @@ -451,7 +451,7 @@ We also can use python script to extract voice. - Step 1, We need to run the following script to get the device index number of Mic Array: -```Python +```python sudo pip install pyaudio cd ~ nano get_index.py @@ -459,7 +459,7 @@ nano get_index.py - Step 2, copy below code and paste on [get_index.py](https://files.seeedstudio.com/wiki/ReSpeaker_Mic_Array_V2/res/get_index.py). -```Python +```python import pyaudio p = pyaudio.PyAudio() @@ -481,7 +481,7 @@ Input Device id 2 - ReSpeaker 4 Mic Array (UAC1.0): USB Audio (hw:1,0) - Step 5, change `RESPEAKER_INDEX = 2` to index number. Run python script [record.py](https://files.seeedstudio.com/wiki/ReSpeaker_Mic_Array_V2/res/record.py) to record a speech. -```Python +```python import pyaudio import wave diff --git a/docs/Seeed_Elderly/reSpeaker/ReSpeaker-USB-Mic-Array.md b/docs/Seeed_Elderly/reSpeaker/ReSpeaker-USB-Mic-Array.md index 3b1dffa1d9f2..42c30e929f59 100644 --- a/docs/Seeed_Elderly/reSpeaker/ReSpeaker-USB-Mic-Array.md +++ b/docs/Seeed_Elderly/reSpeaker/ReSpeaker-USB-Mic-Array.md @@ -285,7 +285,7 @@ cd pixel_ring/pixel_ring - Step 2. Create a [led_control.py](https://files.seeedstudio.com/wiki/ReSpeaker_Mic_Array_V2/res/led_control.py) with below code and run 'python led_control.py' -```Python +```python from usb_pixel_ring_v2 import PixelRing import usb.core import usb.util @@ -418,7 +418,7 @@ We use [PyAudio python library](https://people.csail.mit.edu/hubert/pyaudio/) to **For Linux:** We can use below commands to record or play the voice. -```Python +```python arecord -D plughw:1,0 -f cd test.wav # record, please use the arecord -l to check the card and hardware first aplay -D plughw:1,0 -f cd test.wav # play, please use the aplay -l to check the card and hardware first arecord -D plughw:1,0 -f cd |aplay -D plughw:1,0 -f cd # record and play at the same time @@ -428,7 +428,7 @@ We also can use python script to extract voice. - Step 1, We need to run the following script to get the device index number of Mic Array: -```Python +```python sudo pip install pyaudio cd ~ nano get_index.py @@ -436,7 +436,7 @@ nano get_index.py - Step 2, copy below code and paste on [get_index.py](https://files.seeedstudio.com/wiki/ReSpeaker_Mic_Array_V2/res/get_index.py). -```Python +```python import pyaudio p = pyaudio.PyAudio() @@ -458,7 +458,7 @@ Input Device id 2 - ReSpeaker 4 Mic Array (UAC1.0): USB Audio (hw:1,0) - Step 5, change `RESPEAKER_INDEX = 2` to index number. Run python script [record.py](https://files.seeedstudio.com/wiki/ReSpeaker_Mic_Array_V2/res/record.py) to record a speech. -```Python +```python import pyaudio import wave diff --git a/docs/Seeed_Elderly/reSpeaker/ReSpeaker_6-Mic_Circular_Array_kit_for_Raspberry_Pi.md b/docs/Seeed_Elderly/reSpeaker/ReSpeaker_6-Mic_Circular_Array_kit_for_Raspberry_Pi.md index 1d4a7b0f5f0d..f9c233b0a7b7 100644 --- a/docs/Seeed_Elderly/reSpeaker/ReSpeaker_6-Mic_Circular_Array_kit_for_Raspberry_Pi.md +++ b/docs/Seeed_Elderly/reSpeaker/ReSpeaker_6-Mic_Circular_Array_kit_for_Raspberry_Pi.md @@ -363,7 +363,7 @@ We use [PyAudio python library](https://people.csail.mit.edu/hubert/pyaudio/) to - Step 1, We need to run the following script to get the device index number of 6 Mic pi hat: -```Python +```python sudo pip install pyaudio cd ~ nano get_index.py @@ -371,7 +371,7 @@ nano get_index.py - Step 2, copy below code and paste on get_index.py. -```Python +```python import pyaudio p = pyaudio.PyAudio() @@ -393,7 +393,7 @@ Input Device id 2 - seeed-8mic-voicecard: - (hw:1,0) - Step 5, change `RESPEAKER_INDEX = 2` to index number. Run python script record.py to record a speech. -```Python +```python import pyaudio import wave diff --git a/docs/Sensor/Beyond_Grove/Sensors/Gear_Stepper_Motor_Driver_Pack.md b/docs/Sensor/Beyond_Grove/Sensors/Gear_Stepper_Motor_Driver_Pack.md index a63626b28f58..7812d614608d 100755 --- a/docs/Sensor/Beyond_Grove/Sensors/Gear_Stepper_Motor_Driver_Pack.md +++ b/docs/Sensor/Beyond_Grove/Sensors/Gear_Stepper_Motor_Driver_Pack.md @@ -234,7 +234,7 @@ You can do this yourself by powering the pins one by one, or using a library suc 1. Upload the following code to Thonny and run it. -```Python +```python from gpiozero import Button, LED from time import sleep diff --git a/docs/Sensor/Grove/Grove_Accessories/Current/Grove-Electricity_Sensor.md b/docs/Sensor/Grove/Grove_Accessories/Current/Grove-Electricity_Sensor.md index 582646bf1985..30a86ac11711 100644 --- a/docs/Sensor/Grove/Grove_Accessories/Current/Grove-Electricity_Sensor.md +++ b/docs/Sensor/Grove/Grove_Accessories/Current/Grove-Electricity_Sensor.md @@ -209,7 +209,7 @@ python grove_electricity_sensor.py Here is the code of example: -```Python +```python #!/usr/bin/env python # # GrovePi Example for using the Grove Electricity Sensor (https://www.seeedstudio.com/wiki/Grove_-_Electricity_Sensor) diff --git a/docs/Sensor/Grove/Grove_Accessories/Time/Grove-RTC.md b/docs/Sensor/Grove/Grove_Accessories/Time/Grove-RTC.md index 18422c81e961..e8690e65c74a 100644 --- a/docs/Sensor/Grove/Grove_Accessories/Time/Grove-RTC.md +++ b/docs/Sensor/Grove/Grove_Accessories/Time/Grove-RTC.md @@ -208,7 +208,7 @@ python grove_i2c_rtc.py Here is the code -```Python +```python #!/usr/bin/env python # # GrovePi Example for using the Grove I2C RTC (https://www.seeedstudio.com/wiki/Grove_-_RTC) diff --git a/docs/Sensor/Grove/Grove_Sensors/Accelerometer/Grove-6-Axis_AccelerometerAndCompass_V2.0.md b/docs/Sensor/Grove/Grove_Sensors/Accelerometer/Grove-6-Axis_AccelerometerAndCompass_V2.0.md index 142cb996e299..ceabc29198f2 100644 --- a/docs/Sensor/Grove/Grove_Sensors/Accelerometer/Grove-6-Axis_AccelerometerAndCompass_V2.0.md +++ b/docs/Sensor/Grove/Grove_Sensors/Accelerometer/Grove-6-Axis_AccelerometerAndCompass_V2.0.md @@ -299,7 +299,7 @@ python grove_6axis_accel_compass_example.py Here is the code of example: -```Python +```python #!/usr/bin/env python # # GrovePi example for using the Grove - 6-Axis Accelerometer&Compass v2.0(https://www.seeedstudio.com/depot/Grove-6Axis-AccelerometerCompass-v20-p-2476.html) diff --git a/docs/Sensor/Grove/Grove_Sensors/Barometer/Grove-Barometer-High-Accuracy.md b/docs/Sensor/Grove/Grove_Sensors/Barometer/Grove-Barometer-High-Accuracy.md index 7e3d180cd704..b1f9c53c44af 100644 --- a/docs/Sensor/Grove/Grove_Sensors/Barometer/Grove-Barometer-High-Accuracy.md +++ b/docs/Sensor/Grove/Grove_Sensors/Barometer/Grove-Barometer-High-Accuracy.md @@ -373,7 +373,7 @@ python high_accuracy_barometer_example.py Here is the code : -```Python +```python #!/usr/bin/env python # # GrovePi Example for using the Grove - Barometer (High-Accuracy)(https://www.seeedstudio.com/depot/Grove-Barometer-HighAccuracy-p-1865.html diff --git a/docs/Sensor/Grove/Grove_Sensors/Gas/Grove-Gas_Sensor-MQ2.md b/docs/Sensor/Grove/Grove_Sensors/Gas/Grove-Gas_Sensor-MQ2.md index 2e82b3a00cb5..da2c14fac5b3 100644 --- a/docs/Sensor/Grove/Grove_Sensors/Gas/Grove-Gas_Sensor-MQ2.md +++ b/docs/Sensor/Grove/Grove_Sensors/Gas/Grove-Gas_Sensor-MQ2.md @@ -421,7 +421,7 @@ python grove_gas_sensor.py Here is code of grove_gas_sensor.py: -```Python +```python #!/usr/bin/env python # # GrovePi Example for using the Grove Gas Sensor @@ -527,7 +527,7 @@ python grove_gas_sensor.py ``` Here is code of grove_gas_sensor.py: -```Python +```python #!/usr/bin/env python # # GrovePi Example for using the Grove Gas Sensor diff --git a/docs/Sensor/Grove/Grove_Sensors/Light/Grove-Flame_Sensor.md b/docs/Sensor/Grove/Grove_Sensors/Light/Grove-Flame_Sensor.md index e4054e4a8532..28d1818a195d 100644 --- a/docs/Sensor/Grove/Grove_Sensors/Light/Grove-Flame_Sensor.md +++ b/docs/Sensor/Grove/Grove_Sensors/Light/Grove-Flame_Sensor.md @@ -311,7 +311,7 @@ python grove_flame_sensor.py Here is the code of example: -```Python +```python #!/usr/bin/env python # # GrovePi Example for using the Grove Flame Sensor (https://www.seeedstudio.com/wiki/Grove_-_Flame_Sensor) diff --git a/docs/Sensor/Grove/Grove_Sensors/Light/Grove-Sunlight_Sensor.md b/docs/Sensor/Grove/Grove_Sensors/Light/Grove-Sunlight_Sensor.md index b9b7d77ed21f..1fadffd05804 100644 --- a/docs/Sensor/Grove/Grove_Sensors/Light/Grove-Sunlight_Sensor.md +++ b/docs/Sensor/Grove/Grove_Sensors/Light/Grove-Sunlight_Sensor.md @@ -295,7 +295,7 @@ pip3 install --upgrade seeed-python-si114x **Software** -```Python +```python import seeed_si114x import time import signal diff --git a/docs/Sensor/Grove/Grove_Sensors/Temperature/One-Wire-Temperature-Sensor-DS18B20.md b/docs/Sensor/Grove/Grove_Sensors/Temperature/One-Wire-Temperature-Sensor-DS18B20.md index ffe82636b1f1..55a172a38c3c 100644 --- a/docs/Sensor/Grove/Grove_Sensors/Temperature/One-Wire-Temperature-Sensor-DS18B20.md +++ b/docs/Sensor/Grove/Grove_Sensors/Temperature/One-Wire-Temperature-Sensor-DS18B20.md @@ -215,7 +215,7 @@ pip3 install --upgrade seeed-python-Ds18b20 #### Software -```Python +```python import seeed_ds18b20 import time diff --git a/docs/Sensor/Grove/Grove_Sensors/Touch/Grove-Touch_Sensor.md b/docs/Sensor/Grove/Grove_Sensors/Touch/Grove-Touch_Sensor.md index d995b83350dd..26df57bf99de 100644 --- a/docs/Sensor/Grove/Grove_Sensors/Touch/Grove-Touch_Sensor.md +++ b/docs/Sensor/Grove/Grove_Sensors/Touch/Grove-Touch_Sensor.md @@ -319,7 +319,7 @@ git clone https://github.com/DexterInd/GrovePi.git python3 grove_touch_sensor.py ``` -```Python +```python #!/usr/bin/env python # # GrovePi Example for using the Grove Touch Sensor (https://www.seeedstudio.com/wiki/Grove_-_Touch_Sensor) diff --git a/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_SAMD21/XIAO-SAMD21-MicroPython.md b/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_SAMD21/XIAO-SAMD21-MicroPython.md index a9acfe21ac2e..92dcfa520491 100644 --- a/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_SAMD21/XIAO-SAMD21-MicroPython.md +++ b/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_SAMD21/XIAO-SAMD21-MicroPython.md @@ -112,7 +112,7 @@ Copy the following codes to Thonny. We can see that the blue RX_LED is lit up and blinks once per second -```Python +```python from machine import Pin, Timer led = Pin(18, Pin.OUT) @@ -138,7 +138,7 @@ We need to prepare: - [Grove-Relay](https://www.seeedstudio.com/Grove-Relay.html) - [Seeed Studio XIAO SAMD21](https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0+-p-4426.html) -```Python +```python from machine import Pin, Timer output_4 = Pin(8, Pin.OUT) @@ -175,7 +175,7 @@ We need to prepare: - [Grove-Relay](https://www.seeedstudio.com/Grove-Relay.html) - [Seeed Studio XIAO SAMD21](https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0+-p-4426.html) -```Python +```python from machine import Pin, Timer led = Pin(8, Pin.OUT) @@ -209,7 +209,7 @@ tim.init(period=50, mode=Timer.PERIODIC, callback=fun) ### I2C Support -```Python +```python from machine import Pin, SoftI2C i2c = SoftI2C(scl=Pin(9), sda=Pin(8), freq=100000) diff --git a/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_nRF52840-Sense/Application/XIAO_BLE_HA.md b/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_nRF52840-Sense/Application/XIAO_BLE_HA.md index ebe652509d91..622790ab27ed 100644 --- a/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_nRF52840-Sense/Application/XIAO_BLE_HA.md +++ b/docs/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_nRF52840-Sense/Application/XIAO_BLE_HA.md @@ -138,7 +138,7 @@ Here's the CircuitPython code.
Click to copy the CircuitPython code -```Python +```python # BTHome with DHT20 # This code is based on the excelent code by Koen Vervloesem # https://github.com/koenvervloesem/BTHome-Inertial-Sensor-in-CircuitPython diff --git a/docs/Spanish/Sensor/Grove/Grove_Sensor/Light/_Grove-Flame_Sensor_Spanish.md b/docs/Spanish/Sensor/Grove/Grove_Sensor/Light/_Grove-Flame_Sensor_Spanish.md index 67d719a23c96..c57d684018b6 100644 --- a/docs/Spanish/Sensor/Grove/Grove_Sensor/Light/_Grove-Flame_Sensor_Spanish.md +++ b/docs/Spanish/Sensor/Grove/Grove_Sensor/Light/_Grove-Flame_Sensor_Spanish.md @@ -309,7 +309,7 @@ python grove_flame_sensor.py Aquí está el código de ejemplo: -```Python +```python #!/usr/bin/env python # # GrovePi Ejemplo para usar el Sensor de Flama Grove (http://www.seeedstudio.com/wiki/Grove_-_Flame_Sensor) diff --git a/docs/Spanish/Sensor/Grove/Grove_Sensor/Touch/_Grove-Touch_Sensor_Spanish.md b/docs/Spanish/Sensor/Grove/Grove_Sensor/Touch/_Grove-Touch_Sensor_Spanish.md index 52dfaaaab5c6..96308957a5cb 100644 --- a/docs/Spanish/Sensor/Grove/Grove_Sensor/Touch/_Grove-Touch_Sensor_Spanish.md +++ b/docs/Spanish/Sensor/Grove/Grove_Sensor/Touch/_Grove-Touch_Sensor_Spanish.md @@ -306,7 +306,7 @@ git clone https://github.com/DexterInd/GrovePi.git python grove_touch_sensor.py ``` -```Python +```python #!/usr/bin/env python # # GrovePi ejemplo para usar el Sensor Touch Grove (http://www.seeedstudio.com/wiki/Grove_-_Touch_Sensor) diff --git a/docs/Top_Brand/Arduino/Tutorials/Compiling_Platform/Compiling_MicroPython_for_embedded_devices.md b/docs/Top_Brand/Arduino/Tutorials/Compiling_Platform/Compiling_MicroPython_for_embedded_devices.md index fa5d8fc02b09..8accef0b5250 100644 --- a/docs/Top_Brand/Arduino/Tutorials/Compiling_Platform/Compiling_MicroPython_for_embedded_devices.md +++ b/docs/Top_Brand/Arduino/Tutorials/Compiling_Platform/Compiling_MicroPython_for_embedded_devices.md @@ -86,7 +86,7 @@ sudo cp ~/micropython/ports/samd/build-SEEED_XIAO/firmware.uf2 /media/$USER/Ardu Copy the code below and you will see the blue led flashing -```Python3 +```python3 from machine import Pin, Timer led = Pin(19, Pin.OUT) diff --git a/docs/Top_Brand/Raspberry_Pi/Pi_HAT/RS-485_Shield_for_Raspberry_Pi.md b/docs/Top_Brand/Raspberry_Pi/Pi_HAT/RS-485_Shield_for_Raspberry_Pi.md index ef69140ab3af..8d85acb04ade 100644 --- a/docs/Top_Brand/Raspberry_Pi/Pi_HAT/RS-485_Shield_for_Raspberry_Pi.md +++ b/docs/Top_Brand/Raspberry_Pi/Pi_HAT/RS-485_Shield_for_Raspberry_Pi.md @@ -177,7 +177,7 @@ You can create a new python file and copy the following code into the new file, **Sending Code.** -```Python +```python #!/usr/bin/env python @@ -203,7 +203,7 @@ while 1: **Receive Code** -```Python +```python #!/usr/bin/env python diff --git a/docs/zh-CN/Seeed_Elderly/reSpeaker/ReSpeaker_Mic_Array_v2.0.md b/docs/zh-CN/Seeed_Elderly/reSpeaker/ReSpeaker_Mic_Array_v2.0.md index 07f474d11712..f7cffdfe7755 100644 --- a/docs/zh-CN/Seeed_Elderly/reSpeaker/ReSpeaker_Mic_Array_v2.0.md +++ b/docs/zh-CN/Seeed_Elderly/reSpeaker/ReSpeaker_Mic_Array_v2.0.md @@ -312,7 +312,7 @@ cd pixel_ring/pixel_ring 用下面的代码创建一个 [led_control.py](https://files.seeedstudio.com/wiki/ReSpeaker_Mic_Array_V2/res/led_control.py) 并运行 'python led_control.py' -```Python +```python from usb_pixel_ring_v2 import PixelRing import usb.core import usb.util @@ -376,7 +376,7 @@ sudo apt-get install pavucontrol **对于 Linux 系统 :** 可以使用下面的命令来录制或播放语音。 -```Python +```python arecord -D plughw:1,0 -f cd test.wav # record, please use the arecord -l to check the card and hardware first aplay -D plughw:1,0 -f cd test.wav # play, please use the aplay -l to check the card and hardware first arecord -D plughw:1,0 -f cd |aplay -D plughw:1,0 -f cd # record and play at the same time @@ -386,7 +386,7 @@ arecord -D plughw:1,0 -f cd |aplay -D plughw:1,0 -f cd # record and play at the - 步骤 1,我们需要运行以下脚本来获取麦克风阵列的设备索引号 : -```Python +```python sudo pip install pyaudio cd ~ nano get_index.py @@ -394,7 +394,7 @@ nano get_index.py - Step 2, 复制下面的代码并粘贴到 [get_index.py](https://files.seeedstudio.com/wiki/ReSpeaker_Mic_Array_V2/res/get_index.py). -```Python +```python import pyaudio p = pyaudio.PyAudio() @@ -416,7 +416,7 @@ Input Device id 2 - ReSpeaker 4 Mic Array (UAC1.0): USB Audio (hw:1,0) - Step 5, 将 `RESPEAKER_INDEX = 2` 更改为索引号。运行 python 脚本 [record.py](https://files.seeedstudio.com/wiki/ReSpeaker_Mic_Array_V2/res/record.py) 来录制语音。 -```Python +```python import pyaudio import wave diff --git a/docs/zh-CN/Sensor/Grove/Grove_Accessories/Current/cn-Grove-Electricity_Sensor.md b/docs/zh-CN/Sensor/Grove/Grove_Accessories/Current/cn-Grove-Electricity_Sensor.md index 72384a84b4ab..6dbb628cd71c 100644 --- a/docs/zh-CN/Sensor/Grove/Grove_Accessories/Current/cn-Grove-Electricity_Sensor.md +++ b/docs/zh-CN/Sensor/Grove/Grove_Accessories/Current/cn-Grove-Electricity_Sensor.md @@ -209,7 +209,7 @@ python grove_electricity_sensor.py 以下是示例代码: -```Python +```python #!/usr/bin/env python # # GrovePi Example for using the Grove Electricity Sensor (https://www.seeedstudio.com/wiki/Grove_-_Electricity_Sensor) diff --git a/docs/zh-CN/Sensor/Grove/Grove_Accessories/Time/cn-Grove-RTC.md b/docs/zh-CN/Sensor/Grove/Grove_Accessories/Time/cn-Grove-RTC.md index aaef92fa7abb..4b7727186daf 100644 --- a/docs/zh-CN/Sensor/Grove/Grove_Accessories/Time/cn-Grove-RTC.md +++ b/docs/zh-CN/Sensor/Grove/Grove_Accessories/Time/cn-Grove-RTC.md @@ -208,7 +208,7 @@ python grove_i2c_rtc.py 以下是代码: -```Python +```python #!/usr/bin/env python # # GrovePi Example for using the Grove I2C RTC (https://www.seeedstudio.com/wiki/Grove_-_RTC) diff --git a/docs/zh-CN/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_SAMD21/CN_XIAO-SAMD21-MicroPython.md b/docs/zh-CN/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_SAMD21/CN_XIAO-SAMD21-MicroPython.md index f980e21be3fa..ccbc5d0306f6 100644 --- a/docs/zh-CN/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_SAMD21/CN_XIAO-SAMD21-MicroPython.md +++ b/docs/zh-CN/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_SAMD21/CN_XIAO-SAMD21-MicroPython.md @@ -112,7 +112,7 @@ cp SEEED_XIAO-20220618-v1.19.1.uf2 /media/$USER/Arduino/ 我们可以看到蓝色的RX_LED被点亮并每秒闪烁一次 -```Python +```python from machine import Pin, Timer led = Pin(18, Pin.OUT) @@ -138,7 +138,7 @@ tim.init(period=500, mode=Timer.PERIODIC, callback=fun) - [Grove-Relay](https://www.seeedstudio.com/Grove-Relay.html) - [Seeed Studio XIAO SAMD21](https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0+-p-4426.html) -```Python +```python from machine import Pin, Timer output_4 = Pin(8, Pin.OUT) @@ -175,7 +175,7 @@ tim.init(period=200, mode=Timer.PERIODIC, callback=fun) - [Grove-Relay](https://www.seeedstudio.com/Grove-Relay.html) - [Seeed Studio XIAO SAMD21](https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex-M0+-p-4426.html) -```Python +```python from machine import Pin, Timer led = Pin(8, Pin.OUT) @@ -209,7 +209,7 @@ tim.init(period=50, mode=Timer.PERIODIC, callback=fun) ### I2C Support(12C的支持) -```Python +```python from machine import Pin, SoftI2C i2c = SoftI2C(scl=Pin(9), sda=Pin(8), freq=100000) diff --git a/docs/zh-CN/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_nRF52840-Sense/Application/CN_XIAO_BLE_HA.md b/docs/zh-CN/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_nRF52840-Sense/Application/CN_XIAO_BLE_HA.md index 488e059aa4f8..4d5141088f4c 100644 --- a/docs/zh-CN/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_nRF52840-Sense/Application/CN_XIAO_BLE_HA.md +++ b/docs/zh-CN/Sensor/SeeedStudio_XIAO/SeeedStudio_XIAO_nRF52840-Sense/Application/CN_XIAO_BLE_HA.md @@ -140,7 +140,7 @@ BTHome 是一个通用而强大的标准,用于广播传感器数据和在BLE 单击此处复制CircuitPython代码 -```Python +```python # BTHome with DHT20 # This code is based on the excelent code by Koen Vervloesem # https://github.com/koenvervloesem/BTHome-Inertial-Sensor-in-CircuitPython