Raspberry Pi Document Translator-use-GPIO: Raspberry Pi A and B

Source: Internet
Author: User

Https://www.raspberrypi.org/documentation/usage/gpio/README.md

2016/6/25

GPIO: Raspberry Pi A and B

# #介绍GPIO和在树莓派上进行物理编程

The powerful feature of the Raspberry Pi is the GPIO (general purpose input and output) pins that surround the board, right next to the yellow video output jack.

GPIO Pins

These pins are the physical interfaces of the PI and the outside world. The simplest, you can think of them as switches that can be turned on and off (input) or Raspberry Pi can be turned on or off (output). 17 of the 26 pins are gpio pins, others are power or grounding pins.

# # What are they used for? What can we do with them?

You can program the PIN to interact with the real world in an interesting way. The input must not necessarily come from a real switch; for example, it can be a signal from a sensor or other computer or device. The output can also do a lot of things by opening an led to send signals and data to other devices. If the Raspberry Pi is on the network, you can control the devices that are connected to it from anywhere, and the devices can send back the data. Connecting and controlling physical devices over the Internet is a powerful and exciting thing, and the Raspberry Pi comes from this idea. There are a lot of great examples on our blog.

Note: Not really in any place, of course you need to connect some things to the network, connected to the Internet computer and electricity. So don't give us a letter because of this:)

# # How does GPIO pins work?

# # Output

Note: If you follow the tutorial below, you mistakenly assume that the Gpio is safe and interesting. Plug it in, or power it on your Raspberry Pi, and you might spoil it. If you plug in a device that requires a lot of battery power, there may be some problems, the LED is still on, the motor does not turn. If you are worried about this, you may want to consider using a breakout board, such as Pibrella know you are confident that you are fully using GPIO directly.

Regardless of the Raspberry Pi, the simplest circuit is to use a battery connection light and a switch (where the resistor is used to protect the LEDs)

When we use Gpio as an output, the Raspberry Pi replaces the switch and the power supply. Each pin can be turned on or off, or turned up or down in a computer command. When the pin is in the high state is 3.3v, low is not.

The line surface is the same circuit implemented using the Raspberry Pi, the LED is connected directly to the GPIO pin (it can output +3v3) and a grounded pin (0v is equivalent to the negative of the battery):

The next step is to write a program with a high number of pins raised or lowered. Here is an example written in Python (see Step Two), and here's how to do it in scratch.

# #输入

The output of the Gpio is easy, either on or off, high or low, 3v3 or 0v. The input is a bit more complicated because it depends on the work of the digital device. Although it is possible to connect only one button to the input pin and ground pin, the Raspberry Pi will confuse the judging button whether it is on or off. It may work properly, maybe not. It's a bit like a floating spaceship in the universe, and there's no reference to whether it's going up or down, or even knowing what's rising or falling.

That's why you'll see words like "pull up" or "pull down" in the Raspberry Pi's Gpio tutorial. This is a reference to the input pin to make it easier to know when to accept an input.

If you want to use GPIO as input now, take a look at burping jelly Baby and quick reaction game tutorials, implemented in Python, or a reaction game with scratch implementations.

# #术语表

GPIO

General-purpose input and output; The Raspberry Pi is a pin and something you can do with them. It's called because you can use them for a lot of purposes. Most can be used as input or output, specifically to see your own program.

Led

Light-emitting diode, a small low-energy light source, widely used in electronic products. As an introduction to the realistic computing points on Raspberry Pi.

Realistic computing (physical computing)

The calculation includes all entities that can be connected directly to a computer, including standard input such as keyboards and monitors. think button, light, robot, alarm clock, sensor, home robot, Teddy Bear called Babbage, or something else. We love realistic computing because it's fun, it's a powerful tool for teaching and learning, inspiring creativity, problem solving and collaborative research. Not only is the calculation of the display appealing to children of all ages, you can also make cool things yourself.

# # #附录

When programming Gpio, there are two ways to point them out: GPIO encoding and real-time coding

The encoding of the Gpio

The computer uses this method to recognize the GPIO pin. The exact numbers don't work for people, they jump to the place, so it's not easy to remember them. You can print a reference booklet or a reference board to plug it in.

Real coding

Another way to point out the pin is to use the first number, across and down, by simply starting from the top left (near the SD card). This is the "reality code" that probably looks like this:


How do I use that?

Beginners and children may find the reality code simpler-just a few simple ones. You still need a diagram to know that the gpio pin, the one that is grounded, is the power supply.

In most cases we recommend using GPIO encoding, which is more used, and most of the data is also used in this way. But whatever you do-just use the same way in a program. Note that the PIN code is based on your specific programming language: Scratch is a GPIO and can be selected in Python.

Raspberry Pi Document Translator-use-GPIO: Raspberry Pi A and B

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.