📜 ⬆️ ⬇️

How programmers solve problems

image

Periodically I check the “events” section on the local IT portal, and recently I found there what I was looking for a long time - another hackathon . But not a simple hackathon, but a complex one is correct: without startaprastva, without HRov, without imposing and limiting to those without dinners . In general, I began to collect suitcases ...

About what came of it - read the article.

What? Again?!


Perhaps one of you knows / remembers that I don’t like to do things like the next “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, try something new. My choice fell on the Arduino.
')
The very Arduin, which we gave to the project team as a birthday present for one of the 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? What revives iron and lifts nets from the dead? If not, it is described here what and how. So, it turns out, tambourines help not only administrators, but programmer problems are solved as with spirit. Pobubnell a minute and everything - bugs are fixed, the project is compiled and running. And I have such a tambourine, programmer, loaded with the right energy:

image

But not everyone has such devices. And even if there is, it does not always work. And my - proven, not the first year serves faithfully. In general, I decided to give the opportunity to use the life-giving power of my tambourine to all those who have problems. Not only programmers, of course - a tambourine at all is enough. So the idea of ​​the project “bubna.net” was born - a site with a live broadcast of a tambourine, into which you can bubbling by simply clicking on the button on the page. He pressed, beat, solved his problems, gave way to another suffering person. It was decided to stop at this idea.

There are brains for drone, there is a tambourine too. We needed something that would hit the drum. So I had two steering cars:

image

And this breadboard:

image

And the wires to it, and every small things. By the way, I first met Arduina for the first time only thanks to the realization of this my idea. Therefore, almost everything needed to buy in preparation for the hackathon.

Let's go!


The evening began hakaton. A multimeter, a soldering iron, the necessary glands - he took everything with him to every fireman. Someone, like me, came up with my idea. Someone, like me, came without a team. The rest - without both. As it seemed to me, two more participants got carried away with my bad idea - business analyst Victoria and mobile application programmer Andrey. The tasks were distributed simply: I do iron, and the guys do everything else. The rest is a site with a button and a live broadcast of a tambourine, a presentation, tea, coffee, cookies, anecdotes. My task is to put together all the components of a bubnilki and make it work.

Hackathon took place from Friday evening to Sunday evening. On the first day I decided to deal with arduina, power, breadboard, wires and servami. There were no problems with connecting the serv and arduin, except for power supply jams (the power supply unit from the tonometer had a non-standard plug) and the choice of wire color for the breadboard. The first serv began to execute my commands in an hour.

It was decided to make two “hammers” (one for each servo) - one could alternate and combine strikes, vary delays. "Hammer" - the core of a ballpoint pen with a piece of eraser worn on its end, artistically wiped on the table to a spherical shape. Fasten it with plastic ties to the servo swing and get a good "percussion instrument":

image

Having spent the night safely at home, it was necessary to start making the casing of our musical instrument. For the basis of an automated tambourine, I decided to use trimming veneered chipboard left over from the recently ended suspended repair. To tie all this together, we needed longer ties and wire. Screeds are generally a very useful thing. It turned out very well, considering that all this was done with a cut and bandaged finger (do not ask what happened):

image

Tambourine + Hammers + Base = eBuben:

image

What's inside?


Having returned to the venue of the hackathon, it was necessary to teach this device to sound. Moreover, it sounds melodious enough that the spirits being summoned still correct the problems and not 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, we managed to pick up the minimum and maximum positions of the serv, from which the blows were clearly and well heard; the timings needed for servo strums on a tambourine (to the maximum position) and striking back (to the minimum); etc. The state machine for the transitions serv from rest to stress, shock and back to rest was "invented". A mechanism for asynchronous control of N-servers at the same time (in our case there were two) was added, logging, sample types (silence, hitting the i-th servo or all at the same time), playing and stopping tracks, looping the track, playing for X-seconds and t .d In fact, a small tambourine sequencer was developed. True, without the ability to record music, but only its hardcode directly into the firmware.

All this was controlled via the serial port. Of course, it would be possible to make it possible to load a user track into the Arduin directly from the computer, but there was not enough time for this - to achieve a stable job and not to hit the tambourine in the dirt on the presentation.

Leaky jeans, button accordion and plan B


On the night from Saturday to Sunday, it was necessary to make an interlayer between the bubble and the future web page with a live broadcast. The solution was the console server in Python, which listened to the right url and sent the right byte to the right port. It's simple. But what a big mistake was to put Python 3.x instead of Python 2.x! Who knows will understand…

The night began with the joint viewing of several films by the most enduring participants, and continued on to the bag-sack next to the warm lamp oil heater. All night I dreamed that I burned through jeans. I just felt it. I woke up, checked them, did not find holes, and slept further. In the morning the bayan began to interfere, which the guys at the next table were testing (maybe they will write about it themselves) ... In general, the night was cheerful, no kidding.

Sunday was devoted to finishing everything I saw and linking it to a web page, which my teammates were doing at the same time. Unfortunately, at the presentation with the page, something went wrong, and she refused to launch our device. I think everything would have worked out if I had a second tambourine with me. So I had to use a backup plan: eBuben was launched as a backup button (plan B should always be!).

And here is eBuben, its own persona:



The domain name bubna.net decided not to register - lazily, and the main task was not the site from the start ...
Upd. : it turned out that the domain has already been registered (checked at 11:54 Moscow time). Perhaps someone was inspired by the article.

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

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

PPS But thank you very much to my wife and daughter for letting me go to these IT gatherings. Without their approval and support, I would have failed.

Source: https://habr.com/ru/post/241473/


All Articles