描述
技術規格
1.訊號傳輸型式: 類比 (Analog)
2.全迴轉角度:300∘± 5∘
3.迴轉壽命:15000 次
4.總阻值: 10K (容許誤差±20%)
5.使用溫度範圍: -10℃ ~ +70℃
- 模組尺寸: 4 x 3 cm
商品內容
- 旋鈕可變電阻模組 1個
- RJ11 6P4C 25cm 信號線 1條
程式範例
在此範例配合S4A IO Board 做簡單實驗,旋轉可變電阻時Arduino Serial Monitor輸出對應的數值
// to the pins used:
const int analogInPin = A1;
int sensorValue = 0;// value read from the pot
int outputValue = 0;// value output to the PWM (analog out)
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
// print the results to the serial monitor:
Serial.print(“sensor = ” );
Serial.print(sensorValue);
Serial.print(“\t output = “);
Serial.println(outputValue);
delay(100);
}