<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>ruu1190のブログ</title>
<link>https://ameblo.jp/ruu1190/</link>
<atom:link href="https://rssblog.ameba.jp/ruu1190/rss20.xml" rel="self" type="application/rss+xml" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
<description>ブログの説明を入力します。</description>
<language>ja</language>
<item>
<title>AIが教えてくれたプログラムコード</title>
<description>
<![CDATA[ <p>AIが教えてくれたプログラムコードです。</p><p>前から気になっていたのですが、AIに作ってもらったプログラムコード等に著作権はあるのでしょうか。このこともAIに聞いたら、基本的に著作権は発生しないとのこと。</p><p>自由に使用して構わない（商品にして売り出しても良いそうです）。本当でしょうかね</p><p>まーさておき、これがプログラムコードです。</p><p>&nbsp;</p><p>#include &lt;Arduino.h&gt;<br>#include &lt;WiFi.h&gt;<br>#include &lt;WebServer.h&gt;<br>#include &lt;DNSServer.h&gt;<br>#include &lt;WiFiManager.h&gt;<br>#include &lt;Preferences.h&gt;<br>#include &lt;Wire.h&gt;<br>#include &lt;Adafruit_GFX.h&gt;<br>#include &lt;Adafruit_SSD1306.h&gt;<br>#include "AiEsp32RotaryEncoder.h"<br>#include "Audio.h"<br><br>// --- ピンアサイン定義 (ESP32-S3) ---<br>#define I2C_SDA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 8<br>#define I2C_SCL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 9<br><br>#define ROTARY_ENCODER_A_PIN &nbsp;11<br>#define ROTARY_ENCODER_B_PIN &nbsp;12<br>#define ROTARY_ENCODER_BUTTON_PIN 13<br>#define ROTARY_ENCODER_STEPS &nbsp;4<br><br>#define I2S_BCLK &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4<br>#define I2S_LRC &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5<br>#define I2S_DOUT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;6<br><br>// --- デバイス初期化 ---<br>#define SCREEN_WIDTH 128<br>#define SCREEN_HEIGHT 64<br>Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &amp;Wire, -1);<br><br>AiEsp32RotaryEncoder rotaryEncoder = AiEsp32RotaryEncoder(ROTARY_ENCODER_A_PIN, ROTARY_ENCODER_B_PIN, ROTARY_ENCODER_BUTTON_PIN, -1, ROTARY_ENCODER_STEPS);<br><br>Audio audio;<br>Preferences preferences;<br><br>// --- 東京エリア 12局リスト ---<br>struct RadioStation {<br>&nbsp; const char* name;<br>&nbsp; const char* url;<br>};<br><br>const RadioStation stations[] = {<br>&nbsp; {"TBS Radio", &nbsp; "http://radiko.jp/v2/api/ts?station_id=TBS&amp;l=15"},<br>&nbsp; {"Bunka Hoso", &nbsp;"http://radiko.jp/v2/api/ts?station_id=QRR&amp;l=15"},<br>&nbsp; {"Nippon Hoso", "http://radiko.jp/v2/api/ts?station_id=LFR&amp;l=15"},<br>&nbsp; {"InterFM897", &nbsp;"http://radiko.jp/v2/api/ts?station_id=INT&amp;l=15"},<br>&nbsp; {"TOKYO FM", &nbsp; &nbsp;"http://radiko.jp/v2/api/ts?station_id=FMT&amp;l=15"},<br>&nbsp; {"J-WAVE", &nbsp; &nbsp; &nbsp;"http://radiko.jp/v2/api/ts?station_id=FMJ&amp;l=15"},<br>&nbsp; {"Radio Nippon","http://radiko.jp/v2/api/ts?station_id=JORF&amp;l=15"},<br>&nbsp; {"Bay FM", &nbsp; &nbsp; &nbsp;"http://radiko.jp/v2/api/ts?station_id=BAYFM78&amp;l=15"},<br>&nbsp; {"NACK5", &nbsp; &nbsp; &nbsp; "http://radiko.jp/v2/api/ts?station_id=NACK5&amp;l=15"},<br>&nbsp; {"FM Yokohama", "http://radiko.jp/v2/api/ts?station_id=YFM&amp;l=15"},<br>&nbsp; {"NHK Radio 1", "http://radiko.jp/v2/api/ts?station_id=JOAK&amp;l=15"},<br>&nbsp; {"NHK FM", &nbsp; &nbsp; &nbsp;"http://radiko.jp/v2/api/ts?station_id=JOAK-FM&amp;l=15"}<br>};<br>const int NUM_STATIONS = sizeof(stations) / sizeof(RadioStation);<br><br>// 状態管理<br>int currentStationIdx = 0;<br>int pendingStationIdx = 0;<br>int volume = 10;&nbsp;<br><br>unsigned long lastEncoderMoveTime = 0;<br>bool isSelectionPending = false;<br>bool isVolumeMode = false;<br><br>// OLED画面更新<br>void updateDisplay() {<br>&nbsp; display.clearDisplay();<br>&nbsp; display.setTextColor(SSD1306_WHITE);<br>&nbsp;&nbsp;<br>&nbsp; display.setTextSize(1);<br>&nbsp; display.setCursor(0, 0);<br>&nbsp; if (isVolumeMode) {<br>&nbsp; &nbsp; display.print("-&gt; VOLUME CONTROL &lt;-");<br>&nbsp; } else if (isSelectionPending) {<br>&nbsp; &nbsp; display.print("-&gt; TUNING... &nbsp; &nbsp; &nbsp;&lt;-");<br>&nbsp; } else {<br>&nbsp; &nbsp; display.print(" &nbsp; RADIO PLAYING &nbsp; ");<br>&nbsp; }<br>&nbsp;&nbsp;<br>&nbsp; display.setTextSize(2);<br>&nbsp; display.setCursor(0, 22);<br>&nbsp; display.print(stations[pendingStationIdx].name);<br>&nbsp;&nbsp;<br>&nbsp; display.setTextSize(1);<br>&nbsp; display.setCursor(0, 54);<br>&nbsp; display.print("Vol: ");<br>&nbsp; display.print(volume);<br>&nbsp; display.print(" [");<br>&nbsp; for(int i=0; i&lt;21; i++) {<br>&nbsp; &nbsp; if(i &lt; volume) display.print("|");<br>&nbsp; &nbsp; else display.print(".");<br>&nbsp; }<br>&nbsp; display.print("]");<br>&nbsp;&nbsp;<br>&nbsp; display.display();<br>}<br><br>void configModeCallback(WiFiManager *myWiFiManager) {<br>&nbsp; display.clearDisplay();<br>&nbsp; display.setTextSize(1);<br>&nbsp; display.setCursor(0, 0);<br>&nbsp; display.println("=== Wi-Fi Setup ===");<br>&nbsp; display.println("\nConnect your phone to:");<br>&nbsp; display.setTextSize(2);<br>&nbsp; display.println("ESP32-Radio");<br>&nbsp; display.setTextSize(1);<br>&nbsp; display.println("\nOpen browser to setup.");<br>&nbsp; display.display();<br>}<br><br>void IRAM_ATTR readEncoderISR() {<br>&nbsp; rotaryEncoder.readEncoder_ISR();<br>}<br><br>void setup() {<br>&nbsp; Serial.begin(115200);<br>&nbsp;&nbsp;<br>&nbsp; Wire.begin(I2C_SDA, I2C_SCL);<br>&nbsp; if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {<br>&nbsp; &nbsp; for(;;);<br>&nbsp; }<br>&nbsp;&nbsp;<br>&nbsp; display.clearDisplay();<br>&nbsp; display.setTextSize(1);<br>&nbsp; display.setTextColor(SSD1306_WHITE);<br>&nbsp; display.setCursor(0, 20);<br>&nbsp; display.print("Checking Wi-Fi...");<br>&nbsp; display.display();<br><br>&nbsp; WiFiManager wm;<br>&nbsp; wm.setAPCallback(configModeCallback);<br>&nbsp; wm.setConfigPortalTimeout(180);<br><br>&nbsp; if (!wm.autoConnect("ESP32-Radio")) {<br>&nbsp; &nbsp; display.clearDisplay();<br>&nbsp; &nbsp; display.setCursor(0, 20);<br>&nbsp; &nbsp; display.print("Setup Timeout.\nRestarting...");<br>&nbsp; &nbsp; display.display();<br>&nbsp; &nbsp; delay(3000);<br>&nbsp; &nbsp; ESP.restart();<br>&nbsp; }<br><br>&nbsp; // 以前のステート復元<br>&nbsp; preferences.begin("radiko-s3", false);<br>&nbsp; currentStationIdx = preferences.getInt("station", 0);<br>&nbsp; volume = preferences.getInt("volume", 10);<br>&nbsp; pendingStationIdx = currentStationIdx;<br><br>&nbsp; // オーディオ初期化<br>&nbsp; audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);<br>&nbsp; audio.setVolume(volume);<br><br>&nbsp; // ロータリーエンコーダ初期化<br>&nbsp; rotaryEncoder.begin();<br>&nbsp; rotaryEncoder.setup(readEncoderISR);<br>&nbsp; // 【修正】 setBounds -&gt; setBoundaries<br>&nbsp; rotaryEncoder.setBoundaries(0, NUM_STATIONS - 1, true);&nbsp;<br>&nbsp; rotaryEncoder.setEncoderValue(currentStationIdx);<br><br>&nbsp; updateDisplay();<br>&nbsp; audio.connecttohost(stations[currentStationIdx].url);<br>}<br><br>void loop() {<br>&nbsp; audio.loop();<br><br>&nbsp; bool buttonPressed = (digitalRead(ROTARY_ENCODER_BUTTON_PIN) == LOW);<br><br>&nbsp; if (buttonPressed &amp;&amp; !isVolumeMode) {<br>&nbsp; &nbsp; isVolumeMode = true;<br>&nbsp; &nbsp; // 【修正】 setBounds -&gt; setBoundaries<br>&nbsp; &nbsp; rotaryEncoder.setBoundaries(0, 21, false);<br>&nbsp; &nbsp; rotaryEncoder.setEncoderValue(volume);<br>&nbsp; &nbsp; updateDisplay();<br>&nbsp; } else if (!buttonPressed &amp;&amp; isVolumeMode) {<br>&nbsp; &nbsp; isVolumeMode = false;<br>&nbsp; &nbsp; // 【修正】 setBounds -&gt; setBoundaries<br>&nbsp; &nbsp; rotaryEncoder.setBoundaries(0, NUM_STATIONS - 1, true);<br>&nbsp; &nbsp; rotaryEncoder.setEncoderValue(pendingStationIdx);<br>&nbsp; &nbsp; updateDisplay();<br>&nbsp; }<br><br>&nbsp; if (rotaryEncoder.encoderChanged()) {<br>&nbsp; &nbsp; // 【修正】 getEncoderValue -&gt; readEncoder<br>&nbsp; &nbsp; long value = rotaryEncoder.readEncoder();<br>&nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; if (isVolumeMode) {<br>&nbsp; &nbsp; &nbsp; volume = value;<br>&nbsp; &nbsp; &nbsp; audio.setVolume(volume);<br>&nbsp; &nbsp; &nbsp; preferences.putInt("volume", volume);<br>&nbsp; &nbsp; &nbsp; updateDisplay();<br>&nbsp; &nbsp; } else {<br>&nbsp; &nbsp; &nbsp; pendingStationIdx = value;<br>&nbsp; &nbsp; &nbsp; lastEncoderMoveTime = millis();<br>&nbsp; &nbsp; &nbsp; isSelectionPending = true;<br>&nbsp; &nbsp; &nbsp; updateDisplay();<br>&nbsp; &nbsp; }<br>&nbsp; }<br><br>&nbsp; if (isSelectionPending &amp;&amp; (millis() - lastEncoderMoveTime &gt; 1000)) {<br>&nbsp; &nbsp; isSelectionPending = false;<br>&nbsp; &nbsp; currentStationIdx = pendingStationIdx;<br>&nbsp; &nbsp; preferences.putInt("station", currentStationIdx);<br>&nbsp; &nbsp; updateDisplay();<br>&nbsp; &nbsp; audio.connecttohost(stations[currentStationIdx].url);<br>&nbsp; }<br>}</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>所々で、「修正」とあるのは、AIが間違えたところです。結構ありますね。</p><p>残る作業は、各部品の配線作業と、パソコンにインストールした「ARDUINO IDE」に</p><p>プログラムコードを読み込ませ、ESP32S3というマイコンで使えるように変換する作業となります（この変換をコンパイルをとおす。と業界では読んでいるとのこと）</p><p>&nbsp;</p><p>わワーむずかしそうです。</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/ruu1190/entry-12972126778.html</link>
<pubDate>Wed, 08 Jul 2026 19:09:19 +0900</pubDate>
</item>
<item>
<title>AIが教えてくれた回路図  ESP32S3</title>
<description>
<![CDATA[ <p style="text-align: center;">AIが教えてくれた回路図です。回路図は表示できないとのことです。</p><p style="text-align: center;">この部品の何番ピンからあの部品の何番ピンへ繋いで、のような表示</p><p style="text-align: center;">で教えてくれました。</p><p style="text-align: center;">&nbsp;</p><p style="text-align: center;">&nbsp;</p><p style="text-align: center;">&nbsp;</p><p style="text-align: center;">&nbsp;</p><p style="text-align: center;">&nbsp;</p><p style="text-align: center;"><a href="https://stat.ameba.jp/user_images/20260707/22/ruu1190/8d/a5/j/o0809062015800356732.jpg"><img alt="AIが教えてくれた回路図" contenteditable="inherit" height="322" src="https://stat.ameba.jp/user_images/20260707/22/ruu1190/8d/a5/j/o0809062015800356732.jpg" width="420"></a></p>
]]>
</description>
<link>https://ameblo.jp/ruu1190/entry-12972045985.html</link>
<pubDate>Tue, 07 Jul 2026 22:10:59 +0900</pubDate>
</item>
<item>
<title>ESP32   ラジコの回路図    radiko</title>
<description>
<![CDATA[ <p>いろいろなAIに聞き、回路図とプログラムコードを書いてもらいました。</p><p>AIに尋ねた条件は次のとおりです。</p><p>&nbsp;</p><p>ハードウェア<br>ESP32-S3 DevKit<br>PCM5102A<br>SSD1306 OLED 128×64<br>EC11ロータリーエンコーダ<br>Arduino IDE<br>&nbsp;</p><p>ソフトウェア<br>ラジコを受信したい<br>動作<br>電源ONで前回聞いていた局と音量で動作<br>エンコーダ左右で選局（東京エリア局）<br>約1秒停止で選局<br>エンコーダ押して、Volに変更（音量調節）<br>OLEDにTBS等の局名を表示</p><p>&nbsp;</p><p>すごい時代になりました。</p><p>わずか数秒で回答が来ます。（でも注意書きに書いてあるように本当に動作するかはつくってみないとわかりません）</p><p>ひとつのAIの回答を別のAIに聞くとここが間違っているあそこが違うと帰ってきます。</p><p>AI同士のキャッチボールを行うと正解がわからなくなります。</p><p>&nbsp;</p><p>どうしよう？</p>
]]>
</description>
<link>https://ameblo.jp/ruu1190/entry-12972010922.html</link>
<pubDate>Tue, 07 Jul 2026 15:43:15 +0900</pubDate>
</item>
<item>
<title>ラジコの聞ける局を選定    radiko</title>
<description>
<![CDATA[ <p>調べてみると、昔からある局や、聴いたことのない局といろいろあります。</p><p>とりあえずこんなものですかな。</p><p>AM放送<br>"NHK AM（東京）<br>"TBS Radio"<br>"文化放送"<br>"ニッポン放送"<br>"ラジオ日本"<br>"ラジオNIKKEI第1"<br>"ラジオNIKKEI第2"<br><br>FM放送<br>"TOKYO FM"<br>"J-WAVE"<br>"NHK FM（東京）"<br>"interfm"<br>"BAYFM78"<br>"NACK5"<br>"ＦＭヨコハマ"<br>"LuckyFM 茨城放送"<br>&nbsp;</p>
]]>
</description>
<link>https://ameblo.jp/ruu1190/entry-12971865946.html</link>
<pubDate>Mon, 06 Jul 2026 11:51:17 +0900</pubDate>
</item>
<item>
<title>ESP32    radiko    ラジコを作る</title>
<description>
<![CDATA[ <p>色々と調べていくと、必要な部品がわかってきました。</p><p>&nbsp;</p><p>どこの放送局を受信しているかを目でわかるようにする表示するディスプレ　0.94インチとありますので非常に小さいものです。 <a href="https://stat.ameba.jp/user_images/20260706/07/ruu1190/51/2f/j/o0640048015799805240.jpg"><img alt="" height="315" src="https://stat.ameba.jp/user_images/20260706/07/ruu1190/51/2f/j/o0640048015799805240.jpg" width="420"></a>&nbsp;</p><p>放送局を選択したり、音量を上下させるためのツマミ（ロータリーエンコーダ） &nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;&nbsp;<a href="https://stat.ameba.jp/user_images/20260706/07/ruu1190/a1/e1/j/o0320024015799805276.jpg"><img alt="" height="240" src="https://stat.ameba.jp/user_images/20260706/07/ruu1190/a1/e1/j/o0320024015799805276.jpg" width="320"></a></p><p>&nbsp;</p><p>&nbsp;</p><p>スピーカを鳴らすためのアンプ（デジタル信号をアナログに変換してくれる回路</p><p>内蔵）</p><p>&nbsp;</p><p>&nbsp;</p><p><a href="https://stat.ameba.jp/user_images/20260706/07/ruu1190/9b/58/j/o1000089215799805268.jpg"><img alt="" contenteditable="inherit" height="375" src="https://stat.ameba.jp/user_images/20260706/07/ruu1190/9b/58/j/o1000089215799805268.jpg" width="420"></a></p><p>スピーカー（ここから音がでます）</p><p>&nbsp;<a href="https://stat.ameba.jp/user_images/20260706/07/ruu1190/b2/c6/j/o0640048015799806649.jpg"><img alt="" height="315" src="https://stat.ameba.jp/user_images/20260706/07/ruu1190/b2/c6/j/o0640048015799806649.jpg" width="420"></a></p><p>主要な部品はこのぐらいで済みそうです。</p><p>あとはこれらを入れるケース、ACアダプタ、配線コードぐらいですかね。&nbsp;</p><p>そうそう、先に説明したESP32というマイコンにプログラムコードを書き入れるために、ARDUINO IDEといアプリをパソコンに入れる作業が必要だそうです。</p><p>&nbsp;ARDUINOはアルデュイーノと発音し、なんでもイタリア生まれのマイコンボードで、ウェブ上での作例や書籍なども多く、かつ使いやすい専用の開発環境も 用意されており、電子工作初心者にもオススメだそうです。&nbsp;</p><p>最も重要なプログラムですが、素人に書けるはずがありません。 そこはご時世のAIに聞いてみるのが一番でしょう。&nbsp;</p><p>試しに、説明した部品でラジコを作れますかと聞いたところ、おまかせくださいと返答が来ました。&nbsp;</p><p>どんな局があるのか等を調べて、次回は大まかな仕様を決めたいと思います。</p>
]]>
</description>
<link>https://ameblo.jp/ruu1190/entry-12971844702.html</link>
<pubDate>Mon, 06 Jul 2026 07:47:42 +0900</pubDate>
</item>
<item>
<title>radiko   ラジコを作るぞ</title>
<description>
<![CDATA[ <p>ラジコ(radiko)を作ると決まったら、初心者程度の知識しかないので、なるべく簡単に作れるものを探します。</p><p>&nbsp;</p><p>調べていくと、次の2つが有力候補のようです。</p><p>「ラズパイ」小型コンピュータ「Raspberry Pi(ラズベリー・パイ)」の略称です。基板むき出しのカードサイズのパソコンのようなもので、安価で入手でき、専用のOSを入れて普通のパソコンのように使ったり、電子工作やロボット制御に使ったりします。<br>ESP32はWi‑Fi/Bluetooth通信、各種センサとの連携、WebサーバやIoT機器、オーディオ再生など多機能なマイコンとして幅広い電子工作やプロトタイピングに利用できます。</p><p>ラズパイとESP32の二択でしょうか。ラズパイはネーミングに惹かれましたが、結構なお値段です。</p><p><a href="https://stat.ameba.jp/user_images/20260704/21/ruu1190/e2/6d/j/o0640048015799353938.jpg"><img alt="" contenteditable="inherit" height="315" src="https://stat.ameba.jp/user_images/20260704/21/ruu1190/e2/6d/j/o0640048015799353938.jpg" width="420"></a></p><p>&nbsp;ESP32は1000円から2000円程度で購入できるようです。さてどうしようかしら？</p>
]]>
</description>
<link>https://ameblo.jp/ruu1190/entry-12971708431.html</link>
<pubDate>Sat, 04 Jul 2026 21:24:05 +0900</pubDate>
</item>
<item>
<title>ラジオを聞きたい</title>
<description>
<![CDATA[ <p>先日、物を整理していたらラジオが出てきた、テレビやスマホばかり使っていて、ラジオの存在をすっかり忘れていた。スマホで目を酷使しているので、少しこのラジオを聞いてみようかなと思いスイッチを入れたのだが、我が家の家の中ではAM放送は全滅、FM放送もアンテナをいっぱいに伸ばしても雑音が入り、いろいろな部屋をあっちこっちしてみたが窓際以外では実用にならないことがわかった。使えないとわかると無性に聞きたくなる自分がいることもわかった。さてどうしようか。調べてみるとラジコなるものがあることが書いてあった。そういえばスマホにもアプリがあったっけ。早速スマホで聞いてみるといろいろな局が聞けるではありませんか。でもスマホで聞いたのではなんだか面白くありません。更に調べるとラジコを自作している方がおりました。小さいマイコンを使用してラジコを作っておられました。昔アマチュア無線を趣味としていた自分がいたのを思い出し、自作魂が湧き上がってきました。</p>
]]>
</description>
<link>https://ameblo.jp/ruu1190/entry-12971639203.html</link>
<pubDate>Sat, 04 Jul 2026 07:42:35 +0900</pubDate>
</item>
</channel>
</rss>
