Praktičen izziv (Challenge): LED dimmer, sintetizator zvoka (FRI-SMS)

Rok za oddajo: petek, 14. januar 2022, 23.55

Delujoč program iz naloge 2 lahko preuredite v enostaven sistem za uravnavo svetlosti LED diode (ali več LED diod). Prav tako lahko ustvarite melodijo s pomočjo brenčača. Osnovna koraka za spremembo utripanja LED diode ali brenčača (praktična naloga) v LED dimmer ali sintetizator tonov sta naslednja :

  • skrajšamo interval med vklopi in izklopi LED diode in brenčača (število ponovitev notranje zanke zmanjšamo na 48 oz. 1microsec)
  • spreminjamo razmerje med časovnim intervalom vklopljene in izklopljene LED diode (prve in druge zakasnitve v glavni zanki)
  • spreminjamo skupno periodo (ob enakih zakasnitvah) signala na brenčaču in s tem ustvarimo preproste zvoke za posamezne note oziroma enostavne melodije (npr. za praznično razpoloženje)

V obeh primerih si lahko pripravite tabelo, v kateri imate shranjene podatke za posamezni časovni interval oziroma korak (npr. svetilnost diode ali trenutna nota na brenčaču) in se potem preprosto sprehodite po tej tabeli in realizirate posamezne korake.

V posameznih korakih lahko uravnavate različno svetlost LED diode ali frekvenco posamezne note pri brenčaču. Nalogo lahko razširite v katerikoli smeri, ki vam je zanimiva. Vašo kodo bomo lahko tudi skupaj preizkusili na FRISMS sistemu. Kratko poročilo s kodo oddajte kar tukaj.

---------------------------------------------------------------------------------------------------

You can rearrange the running program from the assignment 2 into a simple LED brightness control system (or multiple LEDs). You can also create a melody with the help of a buzzer. The basic steps for changing the flashing LED or buzzer metronome  (practical task) to an LED dimmer or tone synthesizer are as follows:

  • shorten the interval between switching the LED and buzzer on and off (reduce the number of repetitions of the internal loop to 48 or 1 microsec)
  • change the ratio between the time interval of the on and off LEDs (first and second delays in the main loop) for brightness control
  • change the total period (at the same delays) of the signal on the buzzer and thus create simple sounds for individual notes or even simple melodies (e.g. "christmas melodies")

In both cases, you can prepare a table in which you have data stored for each time interval or step (e.g. diode brightness or current note on the buzzer) and then simply walk through this table and execute the individual steps.

You can adjust the brightness of the LED or the frequency of each note on the buzzer in individual steps. You can also expand the task in any direction that interests you. We can test your code on the FRISMS system together if you need assistance. You can also submit your work with short description here.