銚子高校WS 20241123

; 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:m5stick-c]
platform = espressif32
board = m5stick-c
framework = arduino
upload_speed = 1500000
monitor_speed = 115200
board_upload.flash_size = 8MB
board_upload.maximum_size = 8388608
board_build.f_flash = 80000000L
board_build.filesystem = spiffs
build_flags = 
    -DCORE_DEBUG_LEVEL=0
    -DBOARD_HAS_PSRAM
    -mfix-esp32-psram-cache-issue
    -mfix-esp32-psram-cache-strategy=memw
board_build.partitions = default_8MB.csv
lib_deps =
    m5stack/M5Unified@0.1.11
    adafruit/Adafruit NeoPixel@^1.12.3
#include <Arduino.h>
#include <M5Unified.h>
#include <Adafruit_NeoPixel.h>

int neoPixelPin = 0;
int buttonPin = 26;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, neoPixelPin, NEO_GRB + NEO_KHZ800);

void setup() {
  M5.begin();
  M5.Display.setFont(&fonts::efontJA_16_b);
  M5.Display.setTextColor(TFT_RED);
  M5.Display.println("Hello, World!");
  M5.Display.println("はろーわーるど");
  
  pinMode(26, INPUT);
  
  strip.begin();
  strip.clear();
  strip.show();
}

void loop() {
  if(digitalRead(buttonPin)){
    strip.setPixelColor(0,0,0,100);
    strip.show();
  } else {
    strip.setPixelColor(0,50,50,50);
    strip.show();
  }
  delay(10);
}