五月天青色头像情侣网名,国产亚洲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)電位器實驗的評論 (共 條)

分享到微博請遵守國家法律
唐山市| 玉田县| 明光市| 龙川县| 重庆市| 新河县| 兴宁市| 卓资县| 大关县| 台前县| 阿城市| 越西县| 赞皇县| 友谊县| 阳高县| 图木舒克市| 涡阳县| 吉木乃县| 台安县| 大安市| 育儿| 玛沁县| 分宜县| 长宁区| 珲春市| 蕉岭县| 确山县| 关岭| 剑阁县| 乌拉特后旗| 武宁县| 咸丰县| 万载县| 开封市| 天峻县| 昌都县| 龙江县| 德安县| 湘潭市| 鄂托克前旗| 南丹县|