我的私人博客:www.satxt.com

arduino 用电位器调节LED闪烁频率

int dianwei;
int led = 13;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(led,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
 dianwei = analogRead(A0);
 Serial.println(dianwei);
 digitalWrite(led,HIGH);
 delay(dianwei);
 digitalWrite(led,LOW);
 delay(dianwei);
 
}

 

原文地址:http://jt.satxt.com/arduino/arduino-y-d-w-q-d-j-led-s-s-p-s.html

posted @ 2015-08-08 10:34  pyc  阅读(1281)  评论(0编辑  收藏  举报
我的私人博客:www.satxt.com