ESP32-S3 + PCM5102 でWeb Radio 続き
2025-08-24


SSD1306をつないで、アップデートしました。
ネットや LM Stadio に教えてもらったコードを使いました。
ネットラジオのURLはfoobar2000で検索して、聴けるものを入れてみました。
ビットレートが128Kを超えると、音が途切れます。

禺画像]

●スケッチ
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <WiFiMulti.h>
#include "WiFi.h"
#include "Audio.h"
#include "Rotary.h"

enum STATE { NORMAL, MENU, VOLUME, FUNCTION };
STATE state = NORMAL;  

// Enconder PINs
#define ENCODER_PIN_A 1
#define ENCODER_PIN_B 2
#define PUSH_SW      21

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
// The pins for I2C are defined by the Wire-library. 
const uint8_t I2C_SDA = 18;   // 
const uint8_t I2C_SCL = 17;   // 

#define SCREEN_WIDTH        (128)
//#define SCREEN_HEIGHT       (64)
#define SCREEN_HEIGHT       (32)
#define VUPOS_X     (96)
#define VUPOS_Y     (1)
#define VOLPOS_X     (8)
#define VOLPOS_Y     (22)
// 8×8 のビットマップ(例:アンテナアイコン)
const uint8_t antena[8] PROGMEM = {
  0b11111110,
  0b01010100,
  0b00111000,
  0b00010000,
  0b00010000,
  0b00010000,
  0b00010000,
  0b00000000
};

続きを読む

[arduino]

コメント(全0件)
コメントをする


記事を書く
powered by ASAHIネット