element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • More
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • More
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • More
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • More
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
microbit
  • Learn
  • Learning Center
  • STEM Academy
  • microbit
  • More
  • Cancel
microbit
Blog 10 BBC micro:bit Projects in 10 Days: Day One - Flashing Heart
  • Blog
  • Forum
  • Documents
  • Events
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
microbit requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: jlucas
  • Date Created: 3 Jun 2016 11:32 AM Date Created
  • Views 1558 views
  • Likes 20 likes
  • Comments 3 comments
  • bbc micro:bit
  • microbit
  • beginner micro:bit projects
  • bbc microbit
  • ten bbc micro:bit projects
  • beginner_microbit_projects
  • stemtlc
  • bbc_micro:bit
  • 10projects10days
Related
Recommended

10 BBC micro:bit Projects in 10 Days: Day One - Flashing Heart

jlucas
jlucas
3 Jun 2016

About this project

 

In this simple introductory project, you can teach your pupils how to create flashing images using the BBC micro:bit's LED grid. This is a quick and accessible way to introduce new users to the basics of Microsoft Block Editor and how online code can be applied to external devices.

 

What you'll need

 

1 x BBC micro:bit

1 x Micro USB

1 x Computer or tablet

2 x AAA Batteries & Battery Holder (optional)

 

Getting started

 

To get started with the BBC micro:bit, visit the official website and sign in using your unique facilitator code. This should have been provided when you first received your BBC micro:bit order. Please email BBCmicrobit@bbc.co.uk if you have not received one.

 

After entering your facilitator code, you will be prompted to authenticate your account by entering your username and password from an existing account - such as Facebook, Office 365 or Microsoft. Read and agree to the terms and conditions to complete the sign-in process.

 

Signing in allows you to save and retrieve projects, publish coding scripts to the BBC micro:bit website, set up restricted access groups for your students and share scripts with other users. You can create code on the BBC micro:bit website without signing in, but you won't be able to save your projects and return to them.

 

Project walk through

 

  • Go to the BBC micro:bit website and click 'create code'.

 

  • Under 'Microsoft Block Editor', click 'New project' to open the block editor tool.

 

  • Along the left-hand side of the screen you should see a drop-down menu with titles such as 'basic' 'input', 'loops' etc. Clicking on any of these titles reveals a number of tiles representing different coding commands.

 

  • To get started, click 'basic' and find the tile entitled 'show leds'. Click on this tile and drag it into the main space at the centre of the screen.

 

  • You can select which of the individual LED displays will be illuminated on the BBC micro:bit's array by checking the boxes within this tile. To create a heart shape, check the boxes indicated in the image below:

  • To see a preview of how this will look on your BBC micro:bit, click 'run'.

 

  • Now we want to tell the heart to flash on and off. To do this, click 'basic' under the command menu and this time select the 'pause (ms)' tile. This will command the code to freeze an action for the selected amount of time, indicated in miliseconds. Attach this to your show leds tile by dragging and dropping it directly below the tile as indicated, and change the numerical figure to 500 in order to program a half-second (500 millisecond) pause.

 

 

  • Until you tell the program what to do after the one second pause, nothing will happen. So find the tile entitled 'clear screen' in the basic commands menu, and attach this beneath the pause (ms) block. Then attach another pause (ms) block beneath this and change the figure to 500 milliseconds to keep the heart switched off for a little longer..

 

  • Finally, find a 'forever' tile in the basic commands menu and wrap it around your blocks of code like so:

 

 

  • Click 'run' now and the animated BBC micro:bit should show the heart flashing on and off at half-second intervals on a constant loop. Congratulations, you've created your first script!

 

  • To download your script to your BBC micro:bit, simply click 'compile' and your code will be downloaded as a .hex file.

 

  • If you haven't already, ensure your BBC micro:bit is connected to your computer using the USB connector. It will automatically show up under 'devices' as a USB device. Simply drag and drop the .hex file onto this device. An amber light on the back of the BBC micro:bit device should begin flashing. When this stops, the program is loaded and you can safely disconnect the BBC micro:bit from your computer.

 

  • Finally, re-connect your battery pack to the BBC micro:bit and press the 'reset' button on the device to run your program.

 

Have you tried this project at home or in the classroom? Once you've mastered the flashing heart, why not try experimenting with the featured commands to create more complex flashing loops, or to experiment with other shapes and patterns? Let us know how you get on in the comments section below...

Anonymous

Top Comments

  • Instructorman
    Instructorman over 5 years ago +15

    This is a good project in that it inspires the learner to create an interesting visual effect.  That helps motivate learners because most people like the feeling of accomplishment when they succeed in making…

  • jpnbino
    jpnbino over 4 years ago +3

    Very nice,

     

    I don't  have a microbit board and I'm already coding. So delightful

     

    Kids can learn sooo easily and fall in love with electronics.

Parents
  • jpnbino
    jpnbino over 4 years ago

    Very nice,

     

    I don't  have a microbit board and I'm already coding. So delightful

     

    Kids can learn sooo easily and fall in love with electronics.

    • Cancel
    • Up +3 Down
    • Reply
    • More
    • Cancel
Comment
  • jpnbino
    jpnbino over 4 years ago

    Very nice,

     

    I don't  have a microbit board and I'm already coding. So delightful

     

    Kids can learn sooo easily and fall in love with electronics.

    • Cancel
    • Up +3 Down
    • Reply
    • More
    • Cancel
Children
No Data
Element14

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2022 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube