Steps to make a LED blink from a C/C++ program?

2019-03-11 09:22发布

What are the easiest steps to make a small circuit with an LED flash from a C/C++ program?

I would prefer the least number of dependencies and packages needed.

  • What port would I connect something into?
  • Which compiler would I use?
  • How do I send data to that port?
  • Do I need to have a micro-processor? If not I don't want to use one for this simple project.

EDIT: Interested in any OS specific solutions.

标签: c++ c circuit
7条回答
Luminary・发光体
2楼-- · 2019-03-11 09:57

If you want to blink an LED without a microprocessor (which implies no C/C++), a simple circuit using a 555 timer IC will do the trick. These are common projects in beginner hobbyist electronics books or kits because they're really simple and you can get the parts at any Radio Shack type of place:

If you want to do it in software, as Vlion mentions, everything depends on the hardware being used and the design of the circuit that hooks up the LED.

If you want to try and mess around with something on your PC, here's an article on how to blink LEDs that are hooked up to pins on the PC parallel port:

查看更多
登录 后发表回答