Lesson 15 glowing pendulum blocks lesson¶
construct a pendulum that glows using acceleration.
Topic¶
Acceleration
Quick Links¶
- glowing pendulum block activity
- glowing pendulum block tutorial
- glowing pendulum blocks challenges
- glowing pendulum quiz
- Name
- Directions
- 1. Why are you creating a 'forever' loop?
- 2. Write the line of code to measure the acceleration with respect to the "y" axis and store this value in a local variable called 'acceleration'.
- 3. After storing the acceleration in a variable, write the code to take the absolute value of the acceleration, and store this value inside 'acceleration'.
- 4. Write the code to include acceleration value question 3 to set the brightness on the @boardname@.
- glowing pendulum quiz answers
- Name
- Directions
- 1. Why are you creating a 'forever' loop?
- 2. Write the line of code to measure the acceleration with respect to the "y" axis and store this value in a local variable called 'acceleration'.
- 3. After storing the acceleration in a variable, write the code to take the absolute value of the acceleration, and store this value inside 'acceleration'.
- 4. Write the code to use the acceleration value from question 3 to set the brightness on the @boardname@.
Prior learning/place of lesson in scheme of work¶
Learn how to get the acceleration acceleration, acceleration
value (g-force), in one of three specified dimensions. We will be learning how to get the acceleration using forever loop, a local variable, acceleration, the math library, as well as simple commands, such as led set brightness and led plot all.
Documentation¶
basic.forever(() => {})
let x = 0
input.acceleration(Dimension.X)
Math.abs(0)
led.setBrightness(255)
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
Objectives¶
- learn how to repeat code in the background forever
- learn how create a local variable to store data, so that you can use it in your code
- learn how to get the acceleration value (g-force), in one of three specified dimensions
- learn how to return the absolute value
- learn how to sets the brightness of the LED screen
- learn how to turn on all the LED lights on the LED screen