micro:bit ready: SL06 multi-purpose light sensor

Table of Contents:

 

 


What does it do?

The SL06 xChip is a light sensor that is packed with features:

  • It measures lux.
  • It detects proximity
  • It can recognise colours
  • It includes gesture recognition

Loading the MakeCode extension:

To write code that uses the SL06 in MakeCode you will need to load the SL06 extension:

  • Open MakeCode and start a new project
  • Click on Advanced / Extensions
  • Type in XinaBox/pxt-SL06
  • Click on search
  • Select the SL06 tile

After a few moments the extension should load and you will see a new tab in the left hand menu titled SL06.

Hello world:

Given that the SL06 is so versatile we ideally need to write four different Hello World! programs.

The code below shows you how to use the proximity sensor:

NB:  When using the SL06 with a BBC micro:bit version 1 always provide power to the IM01 and NOT to the micro:bit.  The micro:bit 1 is unable to deliver sufficient power to enable the gesture recognition on the SL06 to work properly.  Powering via the IM01 allows components in the circuit to draw more power.  The new micro:bit 2 delivers more power than the micro:bit 1, but less than the IM01, so when in doubt always power via the IM01.

How-to Guides:

Sample Code:

Use the gesture sensing to build a version of the classic game Simon:

Click here to load MakeCode and view the code


Back to find a micro:bit ready xChip page