Closing Down Sale - At least 50% off EVERYTHING !!!

Search

Cables and Connectors

LED's and Illumination

Motors and Drivers

Announcements

Esme's Electronics

Feature Teacher

Troy's Tutorials

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