This time change the structure of the notes directly. Lit LEDs are always an introductory routine for learning MCU,ARM,FPGA, which can be said to be a classic routine. The author also started the Arm learning journey from the point of light led.
The next step is to light up the LED tour, before you start, you need to explain to the reader: The writer is also an arm beginner, the learning process is also on the Internet to find various materials, and finally summed up in this. Can determine the process of the experiment there are a lot of places the author himself is not understand, so please forgive the reader can not write too thorough.
The first step: to highlight the LED, the first need to understand the GPIO hardware location, so as to operate the corresponding IO port, to achieve lighting purposes
1, after the connection good bb-black, waits for the system to start in the PC browser inside the input 192.168.7.2 can access the Development Board server, here can find many hardware data, also can learn another kind of JS programming, in short, here has a lot of useful information for beginners.
2, for example, the GPIO distribution for the Development Board expansion port. In this experiment, I like other beginners to choose gpio_44 this pin as the target PIN for this experiment. The gpio_44 can be found to correspond to the P8 12-pin, while the P8 2 feet as the grounding pin.
3, the author likes to build a development platform from scratch, there is no ready-made LED lamp module, had to use bread board to build a simple circuit to achieve. As shown in the LED lamp circuit diagram, only need a 330 resistor and a red light-emitting diode.
4. After understanding the schematic, the next step is to connect the breadboard. Connect the circuit diagram as shown. This step allows you to operate the LEDs.
Step two: Light the LED through the shell command on the terminal
1, first enter the Gpio, through the cd/sys/class/gpio/, as shown in the operation first add gpio44.
2, enter the gpio44 directory, write to direction out, and then write 1 to value, so that the LED lights can be lit. Regardless of why, light the LED before going to the principle.
3, repeatedly write to value 0 and 1 can be lit and off LED lights.
Step three: Calm down and look at the shell command.
1. What is the shell?
(1) Interface: The shell is an executable program with special functions, which is an interface between the user and the Unix/linux OS kernel.
(2) Interpreter: The shell is a command interpreter that reads commands from the input device, turns it into an instruction that the computer can understand, and then executes it.
(3) Programming environment: In Linux, the shell is not only a simple command interpreter, but also a full-featured programming environment.
2, how to use the shell?
(1) Several different shells are available in the Linux system, such as Ash,bash, but the shell is usually programmed with bash (Bourne again shell).
(2) You can use any kind of text editor to write shell script program
Note: What is a shell script program?
The shell script is a certain syntax structure to organize several Linux commands together, so that these commands in accordance with our requirements to complete a certain function. It can be written like a program, and can be executed without compiling it.
3. Echo and Cat
Simply put, the echo of this experiment is to write data to a file, and cat is to display the file data.
Summary: This experiment uses the Gpio interface provided by Linux to operate the GPIO44 with the shell command to realize the LED light. Next note the author will use the shell script to realize the flashing of LED lights, which is more interesting.
Bb_black_ Study Notes--(3) The shell command to light the LED