O'Reilly logo

The Official BBC Micro:bit User Guide by Gareth Halfacree

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A

JavaScript Blocks Recipes

THIS APPENDIX CONTAINS complete code listings for the programs detailed in Chapter 6, ‘JavaScript’, and Chapter 8, ‘The Wireless BBC micro:bit’. These can be entered into the JavaScript Blocks Editor visually. Or, you can enter the alternative versions from Appendix B, ‘JavaScript Recipes’, in JavaScript Mode, and then use the Editor toggle to switch back to JavaScript Blocks Mode (see Chapter 6.)

Chapter 6: Hello, World! (Non-looping)

image

Chapter 6: Hello, World! (Looping)

image

Chapter 6: Button Inputs (Single Button)

image

Chapter 6: Button Inputs (Two Buttons)

image

Chapter 6: Touch Inputs

image

Chapter 6: Temperature Sensor (No Formatting)

image

Chapter 6: Temperature Sensor (with Formatting)

image

Chapter 6: Compass Sensor

Chapter 6: Accelerometer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required