How programmers solve problems


    I periodically check the “events” section on the local IT portal, and recently I found there what I was looking for a long time - another hackathon . Yes, not a simple hackathon, but a complex one, right: without startups, without HRs, without imposing and restricting topics, without dinners . In general, I began to pack my bags ...

    About what came of it - read the article.

    What? Again?!

    Perhaps some of you know / remember that I don’t like doing things like another “social network for {placeholder}". And this is my reluctance, as it turned out, completely coincides with the goal of the organizers of the upcoming hackathon. In general, and this time I decided to do something unusual, to try something new. My choice fell on the Arduino.

    The very arduino that we gave to the project team for the birthday of one of our colleagues, and which I managed to rent for the weekend (“squeeze”, as its owner put it). It remained to figure out what to do with it.

    Programming tambourine, standard, one piece

    Does everyone know the legend about the admin tambourine? The one that animates iron and raises nets from the dead? If not, what and how is painted here . So, it turns out that these tambourines not only help administrators, but also solve programmer problems as a matter of spirit. Rumbled a minute and that's it - bugs are fixed, the project compiles and works. And I have such a tambourine, programmer, charged with the right energy:


    But not everyone has such devices. And even if there is, they do not always work. And mine is a proven one, it has been serving faithfully for several years. In general, I decided to give an opportunity to use the life-giving power of my tambourine to all those who have problems. Not only programmers, of course - a tambourine is enough for everyone. So the idea of ​​the “” project was born - a site with a live broadcast of a tambourine, into which you can talk to just by clicking on the button on the page. He pressed, prompted, solved his problems, gave way to another sufferer. It was decided to dwell on this idea.

    There are brains for a nubble, there is a tambourine too. Something was needed that would hit a tambourine. So I got two steering cars:


    And such a breadboard:


    And wires to it, and all small things. By the way, I first got acquainted with arduino only thanks to the realization of this my idea. Therefore, almost everything needed was bought in preparation for the hackathon.

    Let's go!

    The evening began hackathon. A multimeter, a soldering iron, the necessary glands - he took everything with him to every fireman. Someone like me came up with his idea. Someone, like me, came without a team. The rest - without both. It seemed to me that two more participants became interested in my bad idea - business analyst Victoria and programmer of mobile applications Andrey. The tasks were distributed simply: I do iron, and the guys do the rest. The rest is a site with a button and a live broadcast of a tambourine, a presentation, tea, coffee, cookies, and jokes. My task is to put together all the components of the bubblenka and make it work.

    The hackathon took place from Friday evening to Sunday evening. On the first day, I decided to deal with arduino, food, breadboard, wires and servos. There were no problems connecting the serv and arduins, except for the power supply hitch (the power supply from the tonometer had a non-standard plug) and the choice of wire color for the breadboard. The first server began to execute my commands within an hour.

    It was decided to make two “mallets” (one per servo) - this way one could alternate and combine strokes, vary delays. “Hammer” - a rod from a ballpoint pen with a piece of eraser on its end, artistically wiped on a table to a spherical shape. We fasten it with plastic ties to the servo swings and get such a good “percussion instrument”:


    Having spent the night safely at home, it was necessary to take up the manufacture of the body of our musical instrument. For the foundation of an automated tambourine, I decided to use scraps of veneered chipboard left over from a recently completed suspended repair. For fastening all this together, longer ties and a wire were needed. Screeds are generally a very useful thing. It turned out very well, considering that this was all done with a cut and bandaged finger (do not ask what happened):


    Tambourine + mallets + base = eBuben:


    What's inside?

    Returning to the venue of the hackathon, it was necessary to teach this device to sound. Moreover, it sounds melodious enough so that the invoked spirits will nevertheless correct the problems, rather than aggravate them.

    Arduino firmware needs to be written in C ++, my second native language. But this did not save me from banging my head against the wall with or without. Empirically, it was possible to select the minimum and maximum positions of the servos, from which the blows occurred clearly and were clearly audible; timings necessary for the servo to hit the tambourine (to the maximum position) and to strike back (to the minimum); etc. A finite state machine for transitions of serves from rest to stress, shock and back to rest was “invented”. A mechanism has been added for asynchronous control of N-servers at the same time (in our case there were two), logging, sample types (silence, beat by the i-th servo or all at the same time), playing and stopping tracks, looping a track, playing for X-seconds, etc. .d. In fact, a small sequencer for a tambourine was developed. True, without the ability to record music,

    All this was controlled through the serial port. Of course, one could make it possible to load the user’s track into the “arduino” directly from the computer, but there wasn’t enough time for this - to achieve stable work and not to hit the face with a tambourine at the presentation.

    Leaky jeans, button accordion and plan B

    On the night of Saturday to Sunday, it was necessary to make a layer between the little book and the future web page with a live broadcast. The solution was a console server in Python, which listened to the desired url and sent the desired byte to the desired port. Everything is simple. But what a big mistake it was to put Python 3.x instead of Python 2.x! Who knows, he will understand ... The

    night began with the joint watching of several films by the most persistent participants, and continued on a bean bag chair next to a warm tube oil heater. I dreamed all night that I had burned jeans through and through. I directly felt it. I woke up, checked them, did not find holes and slept on. In the morning, the button accordion, which the guys at the next table tested (maybe they will write about it themselves), began to interfere ... In general, it was a fun night, without jokes.

    Sunday was dedicated to completing everything that was cut and linking it to a web page that my teammates worked on at the same time. Unfortunately, something went wrong at the presentation with the page, and she refused to launch our device. I think everything would work out if I had a second tambourine with me. Therefore, I had to use a backup plan: eBuben was launched with a backup button (there should always be a plan B!).

    And here is eBuben, our own person:

    They decided not to register the domain name - it was lazy, and the main task was originally not a site at all ...
    Upd. : it turned out that the domain was already registered (checked at 11:54 Moscow time). Perhaps someone was inspired by the article.

    The goal was achieved, the weekend was not in vain, the nomination "The most technologically advanced project" was ours.

    PS Hackathon was a success. There were a lot of cool projects and passionate people. Thanks to the organizers, I will wait for the next WTH.

    PPS But the biggest thank you to my wife and daughter for letting me go to these IT gatherings. Without their approval and support, I would not have succeeded.

    Also popular now: