验证中...
Languages: C/C++
Categories: 其他
Latest update 2019-11-09 16:59
使用数位计实现旋钮调灯亮度功能
Raw Copy
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.println((map(analogRead(A0), 0, 1023, 0, 255)));
analogWrite(11,(map(analogRead(A0), 0, 1023, 0, 255)));
}
使用1602屏实现实时显示灯的当前亮度功能
Raw Copy
#include <LiquidCrystal_SoftI2C.h>
#include <SoftI2CMaster.h>
LiquidCrystal_SoftI2C mylcd(0x27,16,2,A3,A2);
void setup(){
mylcd.init();
mylcd.backlight();
}
void loop(){
analogWrite(11,(map(analogRead(A0), 0, 1023, 0, 255)));
mylcd.setCursor(0, 0);
mylcd.print((map(analogRead(A0), 0, 1023, 0, 255)));
mylcd.setCursor(0, 1);
mylcd.print("");
}

Comment list( 0 )

Sign in for post a comment

Help Search

191139_cd20d5fd_5186603 191143_ebef6f8d_5186603