# Sugar Line Sensor Module

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/line1.png)

This is an infrared line sensor module in the Sugar sensor series. The holes on the back allow compatibility with plastic building bricks.

### Product Specifications

* Dimensions: 24 x 24 x 16 mm
* Weight: 5g
* Type: Digital
* Sensing Range: 1\~14mm

### Wiring

Use a 3Pin cable to connect the module to Robotbit Edu.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/line_wire1.png)

### Programming Tutorial

### MakeCode Programming Tutorial

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mcbanner.png)

#### Import Sugar Extension

#### Search for sugar in the search bar (Kittenbot products has been verified by Microsoft)

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/sugar_search.png)

#### Extension URL

Sugar extension: <https://github.com/KittenBot/pxt-sugar>

[Importing Extensions Tutorial](https://sharinghub-eng.kittenbot.hk/programming-platforms/makecode-tutorial/kittenbot-and-makecode)

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/line_mc_code.png)

[Sample Program](https://makecode.microbit.org/_achdEoCzK8DV)

#### Kittenblock Programming Tutorial

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/kbbanner.png)

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/line3.png)

#### MicroPython Programming Tutorial

```
Tracker(pin)
value()
```

* value(): Returns Tracker Status

Sample Program

```
from future import *
from sugar import *

tracker = Tracker('P1')

screen.sync = 0
while True:
    if tracker.value() == 1:
        screen.fill(0)
    else:
        screen.fill(255)
    screen.refresh()
```
