内蔵ホールセンサ
ESP32

概要

Arduino core for the ESP32を使った、ESP-WROOM-32開発ボードの内蔵ホールセンサについての実験です。

Arduino core for the ESP32のインストールのページはこちら

実験

Arduino core for the ESP32には、hallRead()という関数が定義されています。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}
 
void loop() {
  // put your main code here, to run repeatedly:
  Serial.printf("hallRead() = %d\n", hallRead());
  delay(1000);
}

上記のスケッチを実行した結果です。

磁石の状態と値の関係は以下の通りです。CPUに磁石を接触させました。

磁石の状態
何もしていない状態 30付近
N極を近づけた状態 負の値
S極を近づけた状態 70付近

バージョン

Hardware:ESP-WROOM-32
Software:Arduino 1.8.3/Arduino core for the ESP32

最終更新日

March 21, 2022

inserted by FC2 system