My group’s focus was on the boolean function. For some that don’t already know, the boolean function is an if-then statement that has two possible values: true or false. In my simple code, I used an if-then statement that integrated light levels and changing numerical values. The program simply states that if the light level is equal to 180, then this will cause the CPX to change to a different pixel color. The statement “If the light level is equal to 180” is also known as the logic statement. As I explained in my video, the logic statement is plugged in for the “true” values. As a result, if that statement is true and the light level equals 180, then there will be a response to a change in the color of blue. In this case, that pixel color is blue. I started with a very simple code so that the concept could easily be acclimated.
https://makecode.adafruit.com/#editor
In my slightly more complex program, I decided to incorporate not just an if-then statement, but rather an if else statement. Slightly more complicated to think about, but really this code is easy to program. The if-else statement is also found under the logic block in the search bar. Now, for the code that you see on the screen right now you begin with a similar set up as before with light level equal to 180 then turn pixel blue, but we see one addition to the program. This new code adds another element to the code, the else statement. The else statement is an example of the false statement. It is used when the light value does not equal 180, it then elicits a pixel color of green. I feel that this slightly more complex statement incorporates that relationship between the true and false statement that I believe the boolean function focuses on.
https://makecode.adafruit.com/#editor
My more complicated or do it differently program played I played with the acceleration. This program is a little more complicated as it takes into account the x- dimension. The X-axis is aligned horizontally from left to right. Left is negative and right is positive. In my code, you can see that I said if the acceleration is greater than 4 then show the red and yellow ring. If I programmed this correctly that should mean that when I tilt the Cpx to the right I will derive the red and yellow ring because these are positive values, On the other hand, if I tilt it to the left, I will derive the all blue ring because these should be negative values. In all three of my codes, I used successive ways of integrating the boolean function.