BBC Micro:bit Recipes : Learn Programming with Microsoft MakeCode Blocks
BBC Micro:bit Recipes : Learn Programming with Microsoft MakeCode Blocks
Click to enlarge
Author(s): Seneviratne, Pradeeka
ISBN No.: 9781484249123
Pages: xxiii, 352
Year: 201907
Format: Trade Paper
Price: $ 75.89
Dispatch delay: Dispatched between 7 to 15 days
Status: Available

Chapter 1: Getting in to programming with MakeCode Chapter Goal: This chapter demonstrates some simple programs that can be built with MakeCode to provide context for what follows and introduces you to the Microsoft MakeCode online web editor. Using MakeCode editor Display text on the display, one character at a time Display numbers on the display, one number at a time Display text on the display, loop it over and over again Display numbers on the display, loop it over and over again Pauses the program for a number of milliseconds specified Displaying icons Chapter 2: Displaying Images Chapter Goal: This chapter presents how to display images and control LEDs on the micro:bit display. First, it shows how to display the built-in images. Then, it shows how to create custom images. Display built-in images Creating an image Creating a double-sized image Images offsetting Scrolling images Animating series of images Creating a flashing effect Stopping animation Displaying arrows Plotting a LED on the display Unpotting a LED on the display Toggling a LED Getting the state of the specified LED Displaying a vertical bar graph Clearing screen Plotting a LED on the screen with specified brightness Changing brightness of a LED Getting the brightness of a LED Turning on or off the display Chapter 3: Inputs and Outputs Chapter Goal: This chapter presents how to use buttons and pins on the micro:bit to handle inputs and outputs. Using built-in buttons as inputs Using external buttons Connecting LEDs Controlling LEDs Using potentiometer to control the brightness of a LED Mapping values Configuring PWM of the analog output Controlling servos Chapter 4: Loops and Logic Chapter Goal: The first part of this chapter guides you how to create loops to repeat things for specified number of times and do things while a condition is met. Finally, it presents how to use logical operations on values. Repeating a thing for specified number of times Run a sequence of actions while a condition is met If a value is true, then do some statements Check whether both inputs are equal each other Check whether both inputs are not equal each other Check whether both inputs true Check whether at least of the inputs is true Inverse an input Chapter 5: Using Mathematical Functions Chapter Goal: This chapter offers how to use the built-in mathematical functions to add, subtract, multiply, or divide numeric values, creating pseudorandom numbers, finding absolute value of a number, calculating remainder, finding max and min values, and convert ASCII characters to text.


Adding numbers Subtracting numbers Multiplying numbers Dividing numbers Generating random numbers Generating true and false randomly Finding remainder Finding minimum and maximum value Finding absolute value of a number Converting ASCII characters to text Chapter 6: Using Variables Chapter Goal: This chapter presents how to use variables to hold data and use them. First, it shows how to declare different type of variables by initializing them with different type of data. Then, it shows how to get data from variables and process them. Finally, it shows how to change data in variables. Creating an integer variable Creating a floating-point variable Creating a string variable Taking data out from variables Changing the value of the variable Changing the value of the variable by a specified value Chapter 7: Functions and Arrays Chapter Goal: This chapter introduces functions and arrays. First, it offers how to build functions to reuse the code. Finally, it presents how to create arrays for different data types (integers and string) and show what are things can do with arrays. Creating a function Creating an array with numbers Creating an array with strings Finding the number of elements in an array Getting the value at the given index in an array Setting the value at the given index Appending a new element to an array Removing the last element from an array Removing the first element from an array Returning the index of the first occurrence of a value in the array Reversing the element in an array Chapter 8: Playing Music Chapter Goal: This chapter presents how to generate music from the micro:bit.


First, it guides how to prepare the hardware for music by attaching a speaker or headphone to the micro:bit pin 0 or different pin. Then, it shows how to play some built-in melodies. After that it covers the fundamentals of music such as tones (notes), beats, tempo, and rest. Next, it presents how build your own melodies based on the fundamentals of music. Finally, it shows how to do something on various melody events. Connecting a speaker to the pin 0 Connecting speaker to a different pin Connecting a headphone Playing a built-in melody Playing a tone (note) Playing a tone for the given duration Rests for the specified time Making melodies Get the frequency of a note Get the duration of the beat Get the tempo in beat Change tempo by the specified amount Set tempo to the specified amount Do something on various melody events Chapter 9: Using Sensors Chapter Goal: This chapter presents how to use sensors with micro:bit to detect physical environment. First, it will show how to use the built-in sensors such as accelerometer, compass, temperature (internal), light (not accurate), and touch. Finally, it will show how to use some external sensors such as light (accurate), temperature (external), moisture, and motion sensor with micro:bit.


Using Internal sensors Accelerometer Compass Temperature Light Touch Using External sensors Light Temperature Moisture Motion Chapter 10: Using Bluetooth Service Chapter Goal: This chapter presents how to use Bluetooth service to connect with smartphones Installing micro:bit app Pairing micro:bit with smartphone Using accelerometer service Using button service Using I/O pin service Using LED service Using temperature service Using magnetometer service Using UART service Creating Eddystone beacons Chapter 11: Using Radio Chapter Goal: This chapter presents how to use the built-in radio to wirelessly broadcast and exchange data between micro:bits. Creating radio groups Setting transmission power Transmitting serial number Sending numeric data Sending text Receiving data Writing received packet to serial Chapter 12: Using Serial and I2C Communication Chapter Goal: This chapter presents how to use Serial, I2C, and SPI communication protocols to exchange data between micro:bit and other devices. Printing a line of text to the serial port Printing a numeric value to the serial port Writing a name-value pair as a line to the serial port Sending a piece of text through the serial connection Printing an array of numeric values as a CSV to the serial port Reading a line of text from the serial port Reading the received data as a string Setting the serial input and output to use pins Reading data through I2C Writing data through I2C Reading data through SPI Writing data through SPI Chapter 13: Building Simple Games Chapter Goal: This chapter presents how to develop simple games with sprites, keep score and control gameplay. Creating a sprite in the game engine Deleting a sprite from the game engine Moving the sprite Turning the sprite Detecting edges and bouncing Getting, setting, and changing the properties of the sprite <.


To be able to view the table of contents for this publication then please subscribe by clicking the button below...
To be able to view the full description for this publication then please subscribe by clicking the button below...