Unit 6 Lesson 3 Puzzle 8

I am having trouble on Unit 6 Leson 3 Bubble 8. I did exactly what the “Do This” instructions told me to do.

  • Add code to make the “blink” and “pulse” buttons work.
  • In design mode, add a new “off” button.
  • Add code to make the “off” button work.
    I make the “blink” and “pulse” buttons work. I add a new “off” button in design mode, then I add code to make the “off” button work. Before I do anything with the “off” button, the “on”, “blink”, and “pulse” buttons work. When I add the “off” code and design, none of them work. What do I do?!

Hi, @akarttunen,

In order to see exactly how your code is working, please include the share link from the upper left corner of the level. I am guessing that your new code is ‘stepping’ on the other code.

Happy computing,
Andrea

https://studio.code.org/projects/applab/sCBNfPcfoqX9y9omTbhf7TnP-FvelZXk917HD8yaWU4

I don’t have my board with me right now, but I was able to get the buttons to trigger a console.log message after I refreshed the page. I also removed the “event” parameter inside the function() calls, but not sure I needed to. (the yellow warning triangles are pointing out that event isn’t used anywhere in the program.)

I’ll try connecting a board later to see if it work.

Mike

Thanks for the share link!

If you select ‘off’ from the onEvent dropdown, it is creating an event for the screen named ‘off’. Basically, wherever you click the screen (including the buttons for on, blink, and pulse), the light will go off. When I renamed the screen ‘testScreen’, renamed the off button ‘offButton’, and selected ‘offButton’ as the onEvent, it worked as you intended. This is a great example of the importance of descriptive variable names.

Hope that helps,
Andrea

1 Like

I got it to work only when I named the off ID “of” rather than “off”. I don’t know why it works that way.

I think as @AndreaRobNott said, you named a screen Off and the button Off … they were trying to share the same name … at least I think that’s what happened.

Glad it’s working.

Mike

Thanks! I will try it.