6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PC98シリーズの起動音をハードウェア実装する

Last updated at Posted at 2021-09-14

RaspberryPIの起動音が寂しいのでarduinoで作りました。
なんでもいいからUSBにつなげておくと通電時に一回だけ鳴ります。

【準備】
arduinoの2番ピンとGNDにスピーカーをつなげろ。

【コード】

pc98.ino
#define SPEAKER_PIN     2       // スピーカー接続ピン
#define TONE_HIGT       2000    // 高音周波数
#define TONE_LOW        1000    // 低音周波数
#define DELAY           100     // 待ち時間(ms)
#define OFF             0       // 再生まだ
#define ON              1       // 再生済み

int flg = OFF;  // 再生フラグ

void setup() {

}

void loop() {
        if(flg == OFF){                         // 再生済み?
                tone(SPEAKER_PIN, TONE_HIGT);   // 高音再生
                delay(DELAY);                   // 待ち
                tone(SPEAKER_PIN, TONE_LOW);    // 低音再生
                delay(DELAY);                   // 待ち
                noTone(SPEAKER_PIN);            // 再生停止
                flg = ON;                       // 再生済みにする
        }
}

コンパイルしてローディングすれば動くはず。
知らねえけど。
機種によって音と長さが微妙に違うので、調べて各機種の起動音を再現しましょう。

オワリ

6
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?