XIAO-RA4M1
Contents
Support[edit]
XIAO-RA4M1
Renesas RA4M1
build-in RGB LED
Arduino IDE[edit]
Compatibilité : version utilisé : 2.3.6 Arduino IDE
Navigate to File > Preferences, and fill "Additional Boards Manager URLs" with the url below: https://files.seeedstudio.com/arduino/package_renesas_1.2.0_index.json
Type the keyword RA4M1
images[edit]
Liens externes[edit]
https://www.seeedstudio.com/Seeed-XIAO-RA4M1-p-5943.html
https://wiki.seeedstudio.com/getting_started_xiao_ra4m1/
Blink [Code][edit]
Navigate to File > Examples > 01.Basics > Blink, open the program.
https://wiki.myows.top/index.php?title=Blink_Examples_01-Basics
Grove Base for XIAO
XIAO-RA4M1
Play with RGB LEDs [Code][edit]
Changer la couleur de la LED entre le rouge, le vert et le bleu
LED user allumé
LED RGB change de couleur, mais lumiere très forte
Bibliothèque : https://github.com/adafruit/Adafruit_NeoPixel
#include <Adafruit_NeoPixel.h>
#define LED_PIN RGB_BUILTIN // Define the pin for the built-in RGB LED
#define NUM_PIXELS 1 // Number of WS2812 LEDs
Adafruit_NeoPixel pixels(NUM_PIXELS, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pinMode(PIN_RGB_EN, OUTPUT); // Set up the power pin
digitalWrite(PIN_RGB_EN, HIGH); //Turn on power to the LED
pixels.begin(); // Initialize the NeoPixel library
}
void loop() {
// Transition from Red to Green
for (int i = 0; i <= 255; i++) {
pixels.setPixelColor(0, pixels.Color(255 - i, i, 0)); // Red decreases, Green increases
pixels.show();
delay(10); // Adjust delay for smoothness
}
// Transition from Green to Blue
for (int i = 0; i <= 255; i++) {
pixels.setPixelColor(0, pixels.Color(0, 255 - i, i)); // Green decreases, Blue increases
pixels.show();
delay(10); // Adjust delay for smoothness
}
// Transition from Blue to Red
for (int i = 0; i <= 255; i++) {
pixels.setPixelColor(0, pixels.Color(i, 0, 255 - i)); // Blue decreases, Red increases
pixels.show();
delay(10); // Adjust delay for smoothness
}
}
Adjust delay for smoothness : Ajustez le délai pour plus de fluidité
Hello Word ! [Code] & OLED Display 1.12[edit]
Grove Base for XIAO
XIAO-RA4M1
OLED Display 1.12 (v2.1) 128 × 128 pixels, Port I2c
int y_offset = 16; // Valeur typique pour SH1107
u8g2.drawStr(0, 24 + y_offset, "Hello World!");
à Tester
bug classique** avec les écrans OLED SH1107 et la bibliothèque **u8g2** : la commande `drawStr(x, y, ...)` ne positionne pas le texte comme prévu.
https://wiki.myows.top/index.php?title=OLED_Display_1.12#Code_Hello_World.21_.28u8g2.29
#include <Arduino.h>
#include <U8g2lib.h>
#include <SPI.h>
#include <Wire.h>
U8G2_SH1107_SEEED_128X128_1_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);
void setup(void) {
u8g2.begin();
}
void loop(void) {
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_ncenB10_tr);
u8g2.drawStr(0,24,"Hello World!");
} while ( u8g2.nextPage() );
}