Running Water Lantern Programming 30, using arrays to write the principle of running light programs

Updated on Car 2024-02-09
2 answers
  1. Anonymous users2024-02-05

    Summary. The flow lamp program uses an array to store the state of each lamp, and realizes the flow lamp effect by looping through the array, and changes the state of the lamp each time it cycles, so as to achieve the flow lamp effect.

    The flow lamp program uses an array to store the state of each lamp, and realizes the stuffy wax effect of the flow lamp socks by looping through the array, and changes the state of the lamp each time, so as to realize the sail effect of the flow lamp.

    Excuse me, but please go into more detail?

    The running light program is usually implemented by enabling a microcontroller or microcontroller. The program uses an array to store the state of the lights, for example, 0 means off, 1 means on, and controls the state of each light by changing the value of the array elements. The program also needs to set a timer to control how often the light flashes and how it can be switched.

    The program will modify the values of the array elements according to certain rules, such as starting with the first light, then moving one place back, turning the first light off, and so on, until the last light is on and then starting again from the first light. By changing the frequency of the timer, you can change the flashing speed of the running light. The principle of running water lamp is relatively simple, but it requires familiarity with the programming language and underlying hardware structure of microcontroller or microcontroller.

  2. Anonymous users2024-02-04

    Summary. The ON and OFF states of the LED lights are stored in an array, and the state change of each LED lamp is controlled in turn by looping to achieve the effect of running lights.

    The ON and OFF states of the LED lights are stored in an array, and the state change of each LED lamp is controlled in turn by looping to achieve the effect of running lights.

    Can you tell us more about that?

    Flowing light is a common control method of LED lights for electronic products, which is generally used in lighting, advertising, etc. It works by arranging different lights to create a dynamic effect. If you use an array to write a running water lamp program, you generally need to save the various states of the LED lamp in the large nano array.

    For example, we can make an array table of length n imitate the state of n LED lights of running lights, and control the effect of LED lights by controlling the value of array elements. In the flow lamp program, a logical loop represents the effect of the actual LED light effect in turn, and this loop controls the lighting on and off by changing the value of the array elements, so as to achieve the effect of the flow lamp in different states. By using the array to control the flow lamp, not only can the dynamic effect be simple and convenient, but also the lighting effect can be easily modified and expanded.

Related questions