五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

ESP32使用旋轉(zhuǎn)電位器實驗

2023-06-15 11:37 作者:南冥的鳥  | 我要投稿


1.1 介紹:??????????????????????????????????????????????????????????????????????

旋轉(zhuǎn)電位器模塊通過旋轉(zhuǎn)電位旋鈕輸出0~5V的模擬電壓,通過單片機的ADC讀取器數(shù)值進行控制其他設備,常用于調(diào)光燈、電機速度調(diào)節(jié)等。

1.2 模塊相關(guān)資料:

? ?相關(guān)資料前往下載鏈接:https://sourl.cn/aGShAV

1.3連接圖

?


1.4測試代碼

Arduino IDE測試程序

#define PIN_ANALOG_IN ?34 ?//the pin of the Potentiometer

?

void setup() {

??Serial.begin(9600);

}

?

//In loop(),the analogRead() function is used to obtain the ADC value,

//and then the map() function is used to convert the value into an 8-bit precision DAC value.

//The input and output voltage are calculated according to the previous formula,

//and the information is finally printed out.

void loop() {

??int adcVal = analogRead(PIN_ANALOG_IN);

??int dacVal = map(adcVal, 0, 4095, 0, 255);

??double voltage = adcVal / 4095.0 * 3.3;

??Serial.printf("ADC Val: %d, \t DAC Val: %d, \t Voltage: %.2fV\n", adcVal, dacVal, voltage);

??delay(200);

}

//**********************************************************************************

?

1.5測試結(jié)果

按照實驗接線圖連接好線,編譯并上傳代碼到ESP32,代碼上傳成功后,利用USB線上電后,打開串口監(jiān)視器,設置波特率為9600,串口監(jiān)視器顯示電位器的ADC值,DAC值和電壓值。轉(zhuǎn)動電位器手柄時,ADC值,DAC值和電壓值發(fā)生變化。


ESP32使用旋轉(zhuǎn)電位器實驗的評論 (共 條)

分享到微博請遵守國家法律
泸州市| 姜堰市| 邳州市| 教育| 常山县| 河池市| 邓州市| 泰安市| 宜君县| 东丰县| 密云县| 炉霍县| 兴业县| 沾化县| 宁德市| 南江县| 济宁市| 株洲市| 安吉县| 鄱阳县| 隆回县| 和龙市| 敖汉旗| 城口县| 德惠市| 华蓥市| 黄山市| 东至县| 温州市| 海伦市| 克东县| 常山县| 吉林市| 黄浦区| 英超| 周宁县| 长春市| 江永县| 巩留县| 阿城市| 滦南县|