目的
Arduinoでボリュームモジュールを使ってファンモーターを回す時のメモ
環境
- Arduino 1.8.16
- PurEyes Arduinoをはじめよう第3版対応 電子工作スターターキット-PDF教本ダウンロード特典付き
上記の教材を使っての操作
プログラム
IDEに以下を入力。
int Val = 0;
int Fan = 9;
void setup() {
pinMode(Fan, OUTPUT);
Serial.begin(9600);
}
void loop() {
Val = analogRead(0);
Serial.println(Val);
analogWrite(9, Val / 4);
delay(100);
}