标签:font input 输出 level dig 基础知识 git 范围 nal
void setup()
{
pinMode(0,INPUT);
digitalWrite(0,HIGH);
pinMode(1,INPUT);
digitalWrite(1,HIGH);
pinMode(2,INPUT);
digitalWrite(2,HIGH);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
}
void loop() {
if(digitalRead(0)==LOW||digitalRead(1)==LOW||digitalRead(2)==LOW)
{
if(digitalRead(0)==LOW)
{
tone(6,2093); 1
digitalWrite(3,HIGH);
}
else{
digitalWrite(3,LOW);
}
if(digitalRead(1)==LOW){
tone(6,2349); 2
digitalWrite(4,HIGH);}
else{
digitalWrite(4,LOW);}
if(digitalRead(2)==LOW){
tone(6,2637); 3
digitalWrite(5,HIGH);}
else{
digitalWrite(5,LOW);}
}
else
{
noTone(6);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
}
}
analogWrite(11,0) 模拟输入{11位端口号,后面的为0~255,0位全灭,255位全亮}
void loop() {
analogWrite(ports[number],level);
delay(10);
++number %=6;
++level %=7;
}
呼吸流水灯,
模拟输入范围[0,1023],模拟输出[0,255]
标签:font input 输出 level dig 基础知识 git 范围 nal
原文地址:http://www.cnblogs.com/edan/p/6043907.html