By The MagPi Team

Show description

Read or Download Learn to code with Scratch PDF

Similar languages & tools books

SOA for the Business Developer: Concepts, BPEL, and SCA

Service-Oriented structure (SOA) is a manner of organizing software program. in the event that your company's improvement tasks adhere to the rules of SOA, the result may be a listing of modular devices referred to as "services," which permit for a fast reaction to alter. This booklet tells the SOA tale in an easy, simple demeanour that can assist you comprehend not just the buzzwords and merits, but additionally the applied sciences that underlie SOA: XML, WSDL, cleaning soap, XPath, BPEL, SCA, and SDO.

Additional resources for Learn to code with Scratch

Example text

The size of the Laser sprite was carefully matched to the SpaceShip sprite by copying the SpaceShip costume, to check where the lasers would appear on the screen. When the green flag is pressed, the Laser sprite is set to appear just below the SpaceShip sprite (Listing 4, overleaf). So it’s in the foreground, but not as close as the cockpit. The lasers are fired by pressing the space bar. 03 the lasers fire for a second, then recharge for a second. This means that the player should not hold down the space bar, but only fire the lasers when needed.

This way, when the button isn’t pressed, the LED will be off. Under else, we insert broadcast gpio17on, to light the LED when the button is pressed. Run the code (as in Listing 4), press that button, and watch your LED! In the next chapter, we’ll add more LEDs to the circuit to make a pedestrian crossing. 04 39 ESSENTIALS ESSENTIALS [ CHAPTER EIGHT ] LED TRAFFIC LIGHTS Following on from the previous chapter, we’ll use three LEDs and a push button to make a pedestrian crossing 40 [ Chapter Eight One ] ] [ LEARN TO CODE WITH SCRATCH ] When the button is pressed, the circuit is broken and Scratch senses a zero value from GPIO pin 21 A piezo buzzer is wired up to the ground rail and GPIO pin 16, for our pedestrian crossing beeps Each LED is connected to a different GPIO pin, so it can be triggered during the traffic light sequence You’ll Need > Solderless breadboard n the latest version of Raspbian Jessie, Scratch features a built-in GPIO server to make it easier to control electronic components or add-on boards.

03 the lasers fire for a second, then recharge for a second. This means that the player should not hold down the space bar, but only fire the lasers when needed. Similar to the SpaceShip sprite script, the Laser sprite only recognises the space bar when the number of shield points is greater than zero. Space debris Two types of space debris were created: LavaBall and Scrap. The script for the LavaBall sprite (Listing 5, overleaf) was copied and modified slightly for the Scrap sprite (Listing 6) to prevent both sprites appearing at exactly the same time.

Download PDF sample

Rated 4.95 of 5 – based on 34 votes