Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize LED experiment with Raspberry Pie

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the raspberry pie how to achieve the LED experiment, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to know it.

Raspberry pie GPIO definition diagram

Just use that GPIO6. The wiring diagram is as follows:

I strung another small resistor just in case.

After the hardware is connected, start writing programs. Install GPIO module, if you import RPi.GPIO does not report an error is already there, do not worry about skipping.

Sudo apt-get updatesudo apt-get install python-rpi.gpio

Ready, the code of the last flashing light

Import RPi.GPIO as GPIOimport timeGPIO.setmode (GPIO.BCM) GPIO.setup (25GPIO.OUT) while True: GPIO.output (25companyGPIO.High) time.sleep (1) GPIO.output (25writerGPIO.LOW) time.sleep (1)

That's fine. It's simple, isn't it?

But there are two things to notice.

At the beginning of 1.RPi.GPIO, I typed RPI.GPIO and couldn't find anything wrong to say that I didn't have this module. Finally, I read the document and found that he was lowercase I.

two。 The program needs to be run under administrator authority, because the operation of GPIO requires root permission, otherwise it will always fail.

Thank you for reading this article carefully. I hope the article "how to realize LED experiment with raspberry pie" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report