-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Seeed-Studio:docusaurus-version' into docusaurus-version
- Loading branch information
Showing
6 changed files
with
228 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
docs/Sensor/ReSpeaker_Lite/XIAO_ESP32_S3/respeaker_rgb_test.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
description: ReSpeaker Lite RGB test | ||
title: RGB test | ||
keywords: | ||
- ReSpeaker | ||
image: https://files.seeedstudio.com/wiki/wiki-platform/S-tempor.png | ||
slug: /respeaker_rgb_test | ||
last_update: | ||
date: 9/27/2024 | ||
author: Jessie | ||
--- | ||
|
||
|
||
### Functionality | ||
|
||
|
||
The RGB light on the ReSpeaker Lite board is using the WS2812 chip and controlled via the `GPIO1` pin. The project cycles through different colors (red, green, blue, and white) to ensure that the RGB light is functioning properly. | ||
|
||
|
||
|
||
|
||
### Code | ||
|
||
```cpp | ||
#include <Adafruit_NeoPixel.h> | ||
|
||
// Define parameters for the LED strip | ||
#define PIN 1 // Pin connected to the RGB LED | ||
#define NUMPIXELS 1 // Number of LEDs | ||
|
||
Adafruit_NeoPixel strip(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); // Initialize the LED strip object | ||
|
||
void setup() { | ||
// Initialize the serial monitor for debugging | ||
Serial.begin(115200); | ||
|
||
// Initialize the RGB LED strip | ||
strip.begin(); | ||
strip.show(); // Initialize all pixels to the off state | ||
} | ||
|
||
void loop() { | ||
// Red color test | ||
Serial.println("Red color test"); | ||
strip.setPixelColor(0, strip.Color(255, 0, 0)); // Set the first pixel to red | ||
strip.show(); // Update the strip display | ||
delay(1000); // Delay for 1 second | ||
|
||
// Green color test | ||
Serial.println("Green color test"); | ||
strip.setPixelColor(0, strip.Color(0, 255, 0)); // Set the first pixel to green | ||
strip.show(); | ||
delay(1000); | ||
|
||
// Blue color test | ||
Serial.println("Blue color test"); | ||
strip.setPixelColor(0, strip.Color(0, 0, 255)); // Set the first pixel to blue | ||
strip.show(); | ||
delay(1000); | ||
|
||
// White color test | ||
Serial.println("White color test"); | ||
strip.setPixelColor(0, strip.Color(255, 255, 255)); // Set the first pixel to white | ||
strip.show(); | ||
delay(1000); | ||
|
||
// Turn off the LED | ||
Serial.println("Turn off the LED"); | ||
strip.setPixelColor(0, strip.Color(0, 0, 0)); // Turn off the first pixel | ||
strip.show(); | ||
delay(1000); | ||
} | ||
``` | ||
<p style={{textAlign: 'center'}}><img src="https://files.seeedstudio.com/wiki/SenseCAP/respeaker/rgb_led.gif" alt="pir" width={400} height="auto" /></p> | ||
### Configuration | ||
`strip.setPixelColor`: set the color LED in the strip. | ||
`strip.show`: applies the color changes to the LED. |
96 changes: 96 additions & 0 deletions
96
docs/Sensor/ReSpeaker_Lite/XIAO_ESP32_S3/respeaker_volume.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
description: ReSpeaker Lite Volume Adjustment | ||
title: Volume Adjustment | ||
keywords: | ||
- ReSpeaker | ||
image: https://files.seeedstudio.com/wiki/wiki-platform/S-tempor.png | ||
slug: /respeaker_volume | ||
last_update: | ||
date: 9/27/2024 | ||
author: Jessie | ||
--- | ||
|
||
|
||
|
||
### Functionality | ||
|
||
|
||
This example project demonstrates how to adjust the volume of the ReSpeaker Lite via I2C command. | ||
|
||
`AIC3204` I2C address: `0x18` | ||
|
||
|
||
### Code | ||
|
||
|
||
```cpp | ||
#include "AudioTools.h" | ||
#include "Wire.h" | ||
|
||
#define AIC3204_ADDR 0x18 | ||
|
||
AudioInfo info_16k(16000, 2, 32); | ||
SineWaveGenerator<int16_t> sineWave(1000); // subclass of SoundGenerator with max amplitude of 32000 | ||
GeneratedSoundStream<int16_t> sound(sineWave); // Stream generated from sine wave | ||
|
||
I2SStream out; | ||
I2SConfig config_i2s1; | ||
|
||
//FormatConverterStream converter(in); | ||
//StreamCopy copier(out, converter); | ||
StreamCopy copier(out, sound); | ||
|
||
uint32_t now_time = 0; | ||
uint8_t level_index = 0; | ||
int8_t level[10] = {0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x00, 0x01, 0x02, 0x03}; | ||
|
||
void aic3204_write_reg(uint8_t reg, uint8_t value) | ||
{ | ||
Wire.beginTransmission(AIC3204_ADDR); | ||
Wire.write(reg); | ||
Wire.write(value); | ||
Wire.endTransmission(); | ||
} | ||
|
||
|
||
void setup(void) { | ||
// Open Serial | ||
Serial.begin(115200); | ||
Wire.begin(5,6); | ||
// while(!Serial); | ||
// AudioLogger::instance().begin(Serial, AudioLogger::Info); | ||
|
||
// start I2S | ||
Serial.println("starting I2S..."); | ||
config_i2s1 = out.defaultConfig(TX_MODE); | ||
config_i2s1.copyFrom(info_16k); | ||
// Custom I2S output pins | ||
config_i2s1.pin_bck = 8; | ||
config_i2s1.pin_ws = 7; | ||
config_i2s1.pin_data = 43; | ||
config_i2s1.pin_data_rx = 44; | ||
config_i2s1.is_master = false; | ||
out.begin(config_i2s1); | ||
|
||
// converter.begin(info_16k, info_48k); | ||
sineWave.begin(info_16k, N_B4); | ||
|
||
Serial.println("started..."); | ||
|
||
} | ||
|
||
// Arduino loop - copy sound to out | ||
void loop() { | ||
copier.copy(); | ||
if (millis() - now_time > 1000) { | ||
now_time = millis(); | ||
aic3204_write_reg(0x00, 0x01); | ||
aic3204_write_reg(0x12, level[level_index]); | ||
aic3204_write_reg(0x13, level[level_index]); | ||
Serial.print("level: "); | ||
Serial.println(level_index); | ||
level_index = level_index + 2; | ||
if (level_index >= 10) level_index = 0; | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters