Radio Inspire

How To Learn Sign Language

Управление WS2812 жестами! DFrobot.com


Hello! Technology does not stand still, and every day they come up with something new. The gesture recognition sensor is not a new thing, but I’m still interested in doing some kind of project. And today we will do lighting control with a gesture sensor. Go! DFRobot is a leading global provider of robotics and open source equipment with a large community serving future creators. DFRobot creates innovative, user-friendly hardware and software products that become the building blocks in all kinds of electronic projects, and forms a strong student community around it. I examined the gesture sensor in detail in the previous video, so be sure to watch this video. The link will be in the description, as well as in the tips. In short, this sensor has 5 touch buttons that can be extended in any way. He also responds to movement up and down, left and right, as well as approaching or moving away. But now, in this case, only a few gestures are used. Based on the recognition of these gestures, you can make lighting control. Let’s look at a simple example. This is a simple test sketch, so that you can see how it all works and test. Consider it. First, two libraries are connected. One library for working with this sensor, and one library for working with addressable WS2812 LEDs. This sensor is connected via the serial interface, and for it to work, you need a Serial connection. Since we will also connect serial to a computer, we can use software serial to operate the sensor. If you use, for example, arduino mega, or ESP8266, then there are additional serial ports, and which are physically installed. And the SoftwareSerial library is not needed. Here we assign the pins to which this sensor is connected, and determine to which serial it will be connected. Next are the settings for working with the WS2812 tape. The pin to which it is connected. Color spectrum. The number of LEDs, and some variables that are optional. They can be deleted. We determine the data array of the LEDs. The variable Mode indicates the operating mode. The Ivent variable is responsible for whether there was any movement or switching event. Or color change. Whether the event was determined or not. In Setup, declare Serial, make a slight delay to start the sensor. We set up work with LED strip, as well as set up work with this sensor. In the main program loop, we call the function for processing movements. Now consider this feature. Motion processing function. If an action is recorded, then we determine that there was an event, and, depending on what action happened, we do some action. If there was a movement “backward” then we change the mode, reduce the value of the variable “mode”. If the movement was “forward”, then we increase the variable changing the operating mode. Also, the movement “right” and “left” change the brightness. Either the brightness increases or decreases. For other events, I did not install any functions. You can disable these events altogether, or add some new features here. Depending on the operating mode, one or another function is performed. These functions simply set a specific color for the LED strip. Simple code and it works easily. With a simple movement, I can change the color, or I can change the brightness. This is the minimum brightness. Increase the brightness. Maximum brightness. The serial port displays all events that occur with this sensor. If I make some movement, then not only the reaction on the tape occurs, but also in the serial port a message is displayed about what I’m doing at the moment. On the network, I found a very good example where a lot of different functions and different operating modes for this tape are collected. Let’s look at this example now. Here is an example. You will find a link to it in the description below the video. I edited this example a bit. Added support for this sensor here, and everything else remained unchanged. Initially, this example was designed to work through serial. That is, through serial there should have been commands that would control the LED strip. In this case, I redid this sketch in order for it to work with this sensor, and therefore the mode will be switched by hand movements. Consider this sketch. It is quite large, and includes three different files. Therefore, I will not consider them all. Just briefly tell you about what I changed. In the beginning I added a library for working with the sensor. Announced which pins SoftwareSerial is connected to. Initialized sensor. Also in Setup, I added the serial port setting, as well as the necessary settings for working with this sensor. In the main cycle of the program. If I go a little lower, I removed the processing value of Serial, but added a function for processing sensor events. Here is this function, it is exactly the same as in the previous sketch. Movements “right-left” changes the brightness, and movements “back and forth” changes the operating mode. I skipped some operating modes, made these modes skipped, because these operating modes consume a lot of arduino operating resources, and then a bad reaction to the sensor occurs. It may either not respond or freeze, and do nothing. Will not respond to any movement. Therefore, I skipped these modes. Now sew this sketch, and see how it all works. Friends in the previous video, I promised to play a discount coupon among subscribers. Today is the time to make this draw. And so, go to the randomizer site. Paste the link to the video. And I hope everyone who wanted to participate left their comments, and did all the necessary actions. Now we will know our winner. Dmitry Plotnikov! “Interesting video, I want a discount coupon.” Great, Dmitry, you won this $ 10 discount coupon! Please contact me in the comments, or find another way to contact me. And I wish everyone else not to miss new videos, because there will be more new draws. And now let’s go further! So, the sketch is flashed, and some mode is working now. Let’s try to switch the mode. It works beautifully, but on a small tape it is not interesting to watch. We need to see it all on a scale! [music] [music] [music] [music] [music] [music] [music] [music] [music] [music] [music]

Leave a Reply

Your email address will not be published. Required fields are marked *