Arduino Smart Car-LED (20180504 Training Course--Huaqing Vision)

1. Arduino LED hardware connection

  • Arduino has a programmable LED light, the corresponding pin number is  13 , please refer to the hardware schematic diagram for details. 
    Arduino-LED.png-369.9kB

2. Arduino LED programming

  • step 1: Set pin 13 as  output  function, the specific programming is as follows:
 
 
  1. #define LED_PIN 13
  2. void setup() {
  3. // put your setup code here, to run once:
  4. pinMode(LED_PIN,OUTPUT); //设置引脚 13 为输出功能
  5. }
  • step 2 : Add the following code to the loop function:
 
 
  1. digitalWrite(LED_PIN,HIGH);//输出高电平,则LED灯亮
  2. delay(1000);
  3. digitalWrite(LED_PIN,LOW);//输出低电平,则LED灯灭
  4. delay(1000);

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325561601&siteId=291194637