In order to populate a database with artificial but semantically valid contents, sometimes we need to obtain random values.
Considering PostgreSQL DBMS, in the case of generating DATE type values, we could create a customized function, named gen_date(), which receives the lower bound for the date to be created as argument:
CREATE OR REPLACE FUNCTION gen_date(min date) RETURNS date AS $$
SELECT CURRENT_DATE - (random() * (CURRENT_DATE - $1))::int;
$$ LANGUAGE sql STRICT VOLATILE;
The following instruction is able to check the function results:
With Arduino, we can generate sounds in several frequencies using a simple buzzer or speaker.
Arduino's API comes with specific functions for this given task: tone() and noTone() [1].
In this project, we'll use a bunch of pushbuttons in order to create a musical keyboard!
The goal is to produce distinct tones for each of the 6 available pushbuttons.
These six tones should correspond to these musical notes: C5, D5, E5, F5, G5, and A5.
Yeah, B5 is missing due to lack of space in my small 400-contacts breadboard.
Note frequencies were retrieved from Physics of Music Notes (MTU Physics) [2].
Arduino's digital pins 9, 10, and 11 have PWM (Pulse-Width Modulation), which means they are able to output a kind of analog signal. This given signal is 8-bits large, that is, integer values ranging from 0 to 255.
On the other hand, Arduino's analog pins can be used to read integer values of 10-bits (from 0 to 1023).
In this project, we'll use a single potentiometer to control bright of 3 Super LEDs at the same time!
Software analyst, physicist, database administrator, developer, computing instructor, free and open source software enthusiast and bass player in his spare time.