Search

Cables & Connectors

Electronics Components

Motors & Controllers

On Sale items!

Get Professional Support

BBC Micro:bit

Robotics

On sale items!

Announcement


Check out our latest news to find out more about events, opportunities and partnerships.

Esmes' Electronics


Esmes' Electronics is a simple introduction to using the micro:bit written by a year 5 student.

Troys' tutorials


Learn with Troy by asking for support and, he will post a tutorial here to benefit all of our visitors. Free advice!

Feature teacher


Be inspired by some of our favorite teachers using our products.

Get professional support


Contact us now to request your own tutorial or learning resource.

This section doesn’t currently include any content. Add content to this section using the sidebar.

Image caption appears here

Add your deal, information or promotional text

The ACCESS:Bit - Part 4

FIND OUT HOW TO CONTROL THE ACCESS:BIT WITHOUT EVEN TOUCHING IT!

Sometimes barriers move for cars or people without them having to push any buttons. In this blog, I'll show you how to do this with your ACCESS:bit!

For this, you’ll need the following: 

 

STEP 1:

After you open MakeCode and download the ACCESS:bit code blocks, add a "forever" basic code block. Then add these two different logic code blocks. Put the comparison code block onto the part of the conditional code block that says "true", and it should look like this:

 

 

STEP 2:

Next, to make it so the ACCESS:bit moves because of light levels, add a "light level" input code block to the first part of the comparison, and make the second part be 128. The 128 represents the light level changing when something gets close to the micro:bit.

 

 

STEP 3:

Now we need to add the ACCESS:bit code blocks to tell the barrier what to do. These are the same code blocks we used in my blog before this one. Change the variables so the code looks like this, and the barrier arm will move up when it is darker around the micro:bit.

 

 

STEP 4:

Next we have to add the code to tell the barrier arm to move down when there is more light on the micro:bit. Repeat the same steps as before but change the variables to look like this:

 

TIPS FOR THIS CODE

There are a few things that I had to go back and double check when I did this code.

  • Make sure the barrier arm is attached at the right angle. The barrier arm will move at the wrong place if the arm has been clipped on at the wrong angle. You might need to remove it and re-attach it.
  • Some lights inside might not make it work right. This code uses light levels to control the barrier arm, So it might be best to try this outside or in natural light. You can also use a torch or phone light to test this out.

Leave a comment (all fields required)

Comments will be approved before showing up.

Search