1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

マイクロマシーン-マイクで遊ぶ(H743)

Last updated at Posted at 2025-01-21

x 過去ログを見よ!!!

目的
秋月電子(秋葉原)で売っている。
ICマイクで遊ぶ。

いろいろ
ICマイクの振動子がすごく、軽量ために
超音波(ソニックウェーブ)まで特性がフラット
でも、人間の音声や楽器は、最低1kHzもあれば、
足りるので、オーバースペックで余計な音を拾いやすい。
ローパスフィルターが必要。
(だれに向かって、何を言っているかわからない? !!! いみふ)
(音スイッチ代わりに使うには、多重平均 まだ未定)

結果

Screenshot from 2025-01-22 06-09-24.jpg

image_original(3).jpg

プログラム



//ser_mic_stm32h743_1


//インクルド
#include <Arduino.h>


//初期化
void setup() {

  pinMode(A1, OUTPUT);  //gpio init
  digitalWrite(A1, HIGH);

  //シリアルポートの初期化
  Serial.begin(9600);

}  //setup


//メインループ
void loop() {

  //電圧を入力する(3.3Vを4096に分解した値)
  analogReadResolution(12);  //センサーの分解度4096
  int s = analogRead(A0);    //センサーの値

  //電圧を温度に変換 ex 20.0 -> 200 温度の十倍を出力
  int Voltage = (s * 3300) >> 12;  // s = s * 3300 / 4096 電圧こと

  //文字列に変換する
  char data[16];                 //出力用文字列
  data[5] = 0;                   //終端記号
  data[4] = '0' + Voltage % 10;  //小数点の値
  Voltage = Voltage / 10;
  data[3] = '0' + Voltage % 10;  //小数点の値
  Voltage = Voltage / 10;
  data[2] = '0' + Voltage % 10;  //小数点の値
  Voltage = Voltage / 10;
  data[1] = '.';                 //小数点の区切り
  data[0] = '0' + Voltage;       //整数1桁目(1の位)

  //整数.小数点3桁で表示 ex 1.650
  Serial.println(data);

  //2msの待ち
  delay(2);

}  //loop



1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?