Last active
May 3, 2024 11:06
-
-
Save mongonta0716/086434d5a0d5d64a9a8367b0d86d273d to your computer and use it in GitHub Desktop.
M5Stack M5NanoC6でRGBLEDを光らせる。(VSCode+Platformio) ※ jsonファイルはboards/m5stack-nanoc6.jsonに作成する。
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
{ | |
"build": { | |
"core": "esp32", | |
"f_cpu": "160000000L", | |
"f_flash": "80000000L", | |
"flash_mode": "qio", | |
"mcu": "esp32c6", | |
"variant": "esp32c6" | |
}, | |
"connectivity": [ | |
"wifi" | |
], | |
"debug": { | |
"openocd_target": "esp32c6.cfg" | |
}, | |
"frameworks": [ | |
"arduino", | |
"espidf" | |
], | |
"name": "Espressif ESP32-C6-DevKitC-1", | |
"upload": { | |
"flash_size": "4MB", | |
"maximum_ram_size": 327680, | |
"maximum_size": 4194384, | |
"require_upload_port": true, | |
"speed": 460800 | |
}, | |
"url": "https://docs.espressif.com/projects/espressif-esp-dev-kits/en/latest/esp32c6/esp32-c6-devkitc-1/index.html", | |
"vendor": "Espressif" | |
} |
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
/** | |
* プロジェクトのフォルダに"boards/m5stack-nanoc6.json"を作りboards_m5stack-nanoc6.jsonの内容をコピーする必要あり。 | |
* @file rgb_led.ino | |
* @author SeanKwok (shaoxiang@m5stack.com) | |
* @brief | |
* @version 0.1 | |
* @date 2024-03-19 | |
* | |
* | |
* @Hardwares: M5NanoC6 | |
* @Platform Version: Arduino ESP32 Board Manager v3.0.0-alpha3 | |
* @Dependent Library: | |
* M5NanoC6: https://github.com/m5stack/M5NanoC6 | |
* Adafruit_NeoPixel: https://github.com/adafruit/Adafruit_NeoPixel | |
*/ | |
#include <M5NanoC6.h> | |
#include <Adafruit_NeoPixel.h> | |
#define NUM_LEDS 1 | |
Adafruit_NeoPixel strip(NUM_LEDS, M5NANO_C6_RGB_LED_DATA_PIN, | |
NEO_GRB + NEO_KHZ800); | |
void setup() { | |
NanoC6.begin(); | |
// Enable RGB LED Power | |
pinMode(M5NANO_C6_RGB_LED_PWR_PIN, OUTPUT); | |
digitalWrite(M5NANO_C6_RGB_LED_PWR_PIN, HIGH); | |
strip.begin(); | |
strip.show(); | |
} | |
void loop() { | |
strip.setPixelColor(0, strip.Color(50, 0, 0)); | |
strip.show(); | |
delay(500); | |
strip.setPixelColor(0, strip.Color(0, 50, 0)); | |
strip.show(); | |
delay(500); | |
// 蓝色 | |
strip.setPixelColor(0, strip.Color(0, 0, 50)); | |
strip.show(); | |
delay(500); | |
} |
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
; PlatformIO Project Configuration File | |
; | |
; Build options: build flags, source filter | |
; Upload options: custom upload port, speed and extra flags | |
; Library options: dependencies, extra library storages | |
; Advanced options: extra scripting | |
; | |
; Please visit documentation for the other options and examples | |
; https://docs.platformio.org/page/projectconf.html | |
[env:m5stack-nanoc6] | |
board = m5stack-nanoc6 | |
platform = https://github.com/platformio/platform-espressif32.git | |
platform_packages = | |
platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git | |
platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-libs.git#idf-release/v5.1 | |
monitor_speed = 115200 | |
upload_speed = 1500000 | |
board_build.partitions = default.csv | |
framework = arduino | |
lib_deps = | |
https://github.com/m5stack/M5NanoC6.git | |
adafruit/Adafruit NeoPixel@1.12.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment