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 always provide power to the IM01 and NOT to the micro:bit.  The micro:bit is only able to deliver 3.3V, and the SL06 requires more power to work properly.  Powering via the IM01 allows components in the circuit to draw more power.

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