咱不是为了开这个灯,要是开这个灯的话,买个小米开关就行了.
我就想知道一下原理...
得买个啥,用什么编程语言控制?
也不指望得到很详细的答案,各位的只言片语,就能让我有所了解,知道该看什么方便的资料了.
请不慎赐教!
伊谢尔伦2017-04-17 14:30:11
Some interesting related books: "Coding: The Language Hidden Behind Computer Software and Hardware"
In terms of textbooks, computers are controlled by software all the time. A book on the principles of computer composition can explain how computers are controlled by software.
Feel like even if you understand it, it’s just words on paper? Then you can build a computer from scratch by yourself: from NAND gate to Tetris, there are also video online courses recorded by two cute uncles
Just kidding. . . The time span above is a bit long. If you want to get started right away, just buy a raspberry pi. Running linux, the standard language is python, and the board comes with GPIO (general purpose input/output). It is not easy to light a small light bulb or something.
Search raspberry pi led on Baidu and there must be a lot of zero-based tutorials. If the English is a little more reliable, just search on Google. Relatively speaking, the information is more informative and there are fewer pitfalls.
怪我咯2017-04-17 14:30:11
I used to be very curious about how software controls hardware, but I didn’t have any exposure to similar knowledge in college.
Recommend you a relatively simple implementation method in very popular terms:
1. Serial communication controls Arduino’s GPIO
arduino is connected to computer usb, and arduino is controlled through computer serial communication. Just input 1 on the computer, Then the Arduino reads 1, inputs 0, and reads 0. Assuming you have some programming skills, you can make the GPIO of your Arduino output a high level or a low level according to the input 0 or 1~ But The current is too weak and cannot light up an ordinary light bulb at all. What should I do? At this time, I think of the relay I learned in junior high school! At this time, you connect the GPIO to the weak current end of the relay and back to ground. At this time, your arduio can control the switch of the relay~
This step requires simple arduino programming knowledge. In fact, you can copy some online.
2. Relay controls ordinary light bulbs
A relay allows weak current to control strong current.
Here you can control the switch of the relay by controlling the weak current of arduino, which is to control the switch of ordinary light bulbs! Wow~ This step has made it possible
You need some circuit knowledge (junior high school)
ringa_lee2017-04-17 14:30:11
Hardware: Arduino can use C language (after struggling for a while, I don’t know if there are other languages that can be developed)
Hardware: Raspberry pi can use Python
For relevant information, you can Baidu树莓派实验室
大家讲道理2017-04-17 14:30:11
echo 66 > /sys/class/backlight/acpi_video0/brightness
The above shell sentence can set the screen brightness of my laptop.
For this scenario, you can use any programming language to do it, as long as the platform you are on supports the programming language you want to use.
PHP中文网2017-04-17 14:30:11
Using Arduino is the easiest solution. Arduino is a rapid prototyping development solution for hardware. Don’t scratch your head just by looking at the hardware. In fact, Arduino is really simple. It is developed using a programming language similar to C language. The syntax is so simple that as long as you can pass C language II You will definitely be able to understand it in the level exam. The Arduino development board can operate some I/O very conveniently and supports buses such as I2C / TWI.
If you want to control the light on and off, you need to equip the Arduino development board with a relay module, and then simply use a Boolean value to command the relay to turn on and off, thereby controlling the light on and off.