This shows you the differences between two versions of the page.
pm:prj2022:cstan:crystal_ball [2022/05/27 23:36] adriana.costan |
pm:prj2022:cstan:crystal_ball [2022/05/27 23:50] (current) adriana.costan |
||
---|---|---|---|
Line 39: | Line 39: | ||
===== Software Design ===== | ===== Software Design ===== | ||
- | For this project I used the library LiquidCrystal_I2C.h such that I can display on the I2C LCD the answers given by the Crystal Ball. In order to make this toy to work I am running the sketch CrystalBall.ino. | + | For this project I used the library LiquidCrystal_I2C.h such that I can display on the I2C LCD the answers given by the Crystal Ball. In order to make this toy to work I am running the sketches CrystalBall.ino and Music.ino. |
In CrystalBall.ino: | In CrystalBall.ino: | ||
- | I have defined the notes for the background song, the melody and the notes duration; then I have initialized the pins for the tilt sensor, piezo and speaker. | ||
+ | Firstly, I have initialized the pins for the tilt sensor, piezo. | ||
In setup() I have displayed the initial message on the LCD: "Ask the Crystal Ball!" | In setup() I have displayed the initial message on the LCD: "Ask the Crystal Ball!" | ||
+ | In loop() I initialized the sequence of the LEDs flickering in order to play constantly during the functioning of the toy and using a switch-case algorithm the toy would generate 1 out of 8 possible answers. | ||
- | In loop() I initialized the sequence of the LEDs flickering and the background music playout in order to play constantly during the functioning of the toy and using a switch-case algorithm the toy would generate 1 out of 8 possible answers. | + | In Music.ino: |
+ | |||
+ | First I have defined the notes for the background song, the melody and the notes duration and initialized the pin for the speaker. | ||
+ | In loop() I have the for with which I play on repeat the background music. | ||
===== Obtained results ===== | ===== Obtained results ===== | ||
Line 55: | Line 60: | ||
One of the 8 possible answers: | One of the 8 possible answers: | ||
+ | |||
{{ :pm:prj2022:cstan:resultscrystalball3.jpeg |}} | {{ :pm:prj2022:cstan:resultscrystalball3.jpeg |}} | ||
- | |||
- | |||
Line 64: | Line 68: | ||
===== Download ===== | ===== Download ===== | ||
- | {{:pm:prj2022:cstan:crystalball.7z|}} | + | The code: {{:pm:prj2022:cstan:crystalball.7z|}} |
+ | The PDF version of the project: {{:pm:prj2022:cstan:crystal_ball.pdf|}} | ||
===== Bibliography/Resources ===== | ===== Bibliography/Resources ===== | ||
Link for Project Crystal Ball: [[https://ocw.cs.pub.ro/courses/pm/prj2022/cstan/crystal_ball]] | Link for Project Crystal Ball: [[https://ocw.cs.pub.ro/courses/pm/prj2022/cstan/crystal_ball]] |