Skip to content

Latest commit

 

History

History
14 lines (9 loc) · 2.12 KB

kenza'sclaplight.md

File metadata and controls

14 lines (9 loc) · 2.12 KB

Three Programs, Three Paragraphs

The Plain Vanilla Program

The program I decided to start with was a simple clap light program. When the CPX picks up a noise above a certain threshold it emits a bright white light. On makecode this was made without using the forever loop. Instead, I used the input function “on loud sound” . Then I put light function for brightness and light color within the input function in the order that I wanted the elements to occur. On a loud sound the brightness and color of the lights are set.

French Vanilla

To make this code more complex but within the same theme, I played around with the light color and animation settings. I also made it so that the the light turned off after one second, as the CPX was beginning to get very hot, I assume because the brightness of the lights was set so high and it had been on for a little while. Within the input function I added a pause and a set all pixels to black so that the lights would turn off after being activated by a loud noise. I also tried to figure out how to make the lights turn on at the sound of a clap and then turn off at the sound of a clap so it would be like those clap on clap off lights from that old infomercial but I have not yet succeeded.

Organic Vanilla Sourced From Madagascar

Approaching the sound activated light from another direction I explored the logic functions. I found that the clap light could also be created if the “if true” function was placed inside the “on loud sound” function, and then the brightness settings and pause were put inside the “if true” function. I guess that makes sense, the “if true” statement goes unsaid in the original way I made the claplight but is still a fact. If it is true that there is a loud noise, the lights turn on for two seconds then turn off. This is what is happening in both versions even though in the first the if true part is not specified.

See this video guide for a step by step tutorial:

<iframe width="630" height="394" src="https://www.useloom.com/embed/8d25c9ecd2e74014847c6faee400cfbc" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>