Demo entry 6631526

Arduino

   

Submitted by anonymous on Jul 16, 2017 at 09:51
Language: C++. Code size: 390 Bytes.

void setup()                      // run once, when the sketch starts
{
  pinMode(2, INPUT); //设定管脚2是输入信号。
  pinMode(13, OUTPUT); // 这个管脚的有啥特殊前面说了,好好回忆一下。
}

void loop()                       // run over and over again
{
  int v = digitalRead(2);  //读入二号管脚的值

  if(v == 1) { //如果是高电平 1
     digitalWrite(13, HIGH); 
  }
  else { //如果是低电平0
    digitalWrite(13, LOW); 
  }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).