top of page

RGB Color Sensor Demo 1

This simple program prints the colors from the RGB color sensor connected to port D of the JackBord.

Program


---

RGB Color Sensor Demo 1

This simple program prints the colors from the

RGB color sensor connected to port D of the JackBord.

---


prog_vars =

d/count 0

d/red_line 0

d/green_line 0

d/blue_line 0

d/clear_line 0

prog_vars.


prog_start =

pclear

print "RGB Color Sensor Demo 1: Start"

-- Enable the I2c system

i2con

prog_start.


prog_loop =


-- main program loop


-- print the readings from the RGB Color sensor.

print "C /cs_clear R /cs_red G /cs_green B /cs_blue"

-- Set the USER 1 LED to the color.

l1 /cs_red /cs_green /cs_blue


-- Wait 1sec

d1000

-- RUn 100 times

any /count >= 100 -> exitprog

inc /count

prog_loop.

prog_stop =

print "Bye"

prog_stop.




bottom of page