W80X Arduino flicker LED

Publish in 2023-07-13 10: 33: 43
First of all, We will learn how to make LED flicker. This will lay the foundation for our further research. Because you've done this step, I believe that I will have a certain sense of achievement in my future study.

necessity

  1. 1 x breadboard
  2. 1 x W801 plate
  3. 1 X LED The lamp (Or you can not use it, It's on the development board)
  4. 1 × 330Ω resistance
  5. 2 × Jumper wire

Wiring diagram

Connect the components on the breadboard according to the circuit diagram, As shown in the following picture.
template 1. jpg

Rough sketch

Open it on your computer Arduino IDE software. Use Arduino Language encodes and controls the circuit. tap "new" Open the new sketch file. Specific configurations are not discussed here.
open. jpg

CODE

/*
   Blink
   Turns on an LED on for one second,  then off for one second,  repeatedly. 
*/
void setup () 
{
   // initialize digital pin PA2 as an output. 
   pinMode (PA2,  OUTPUT) ; 
}
// the loop function runs over and over again forever. 
void loop () 
{
   digitalWrite (PA2,  HIGH) ;  // turn the LED on  (HIGH is the voltage level) 
   delay (1000) ;  // wait for a second. 
   digitalWrite (PA2,  LOW) ;  // turn the LED off by making the voltage LOW
   delay (1000) ;  // wait for a second. 
}

Code import procedure

First click Verify Verify that the code is correct

986fdeefda2e169b3a595a6661596927. jpg

Then click Upload A save dialog box is displayed for uploading the code, Edit the file name in the appropriate location and save it

63e12554a54b575cf521d02a632ec5ad. jpg
1689221272338_copy. jpg

You can also do the following

Burning procedure 1_copy. jpg

Finally, it takes more than ten seconds to upload, If the following is displayed, it indicates success

6f1f1a696c4d4368c9238972d20e5c5b. jpg

Code interpretation

pinMode (PA2,  OUTPUT) ; 

You need to tell W801 It is INPUT still OUTPUT. We can use the built-in "function" pinMode () To do that.

digitalWrite (PA2,  HIGH) ; 

When using pins as output, It can be commanded as HIGH (exportation 5V) or LOW (exportation 0V) .

result

You can see yours LED Open and close. If you don't see the results you want, Make sure you have assembled the circuit correctly, The code has been verified and uploaded to the board.

0 Pieces of review

publish
problem