Itty Bitty Buggy: Color Detector Tutorial (mDesigner)

From Microduino Wiki
Jump to: navigation, search

Color Detector

Buggy Base also contains two Color Detector sensors on the underside, right next to the ColorLEDs. The Color Detectors are capable of detecting color. These are useful when following along a color line. The Color Detectors are referenced as Color Detector "A" or "B" depending on the side it is on.

Block: Detect Color

The Color Detector can be utilized using the Color Detector - Detect Color block.

Function: This block reads and returns either true or false if the selected color detector detects the selected test color.

IBB mDesigner LineFInder Block Test Color.png
  • Sensor - select sensor for detection (either A or B).
  • Color - color for the selected Sensor to match in order to return true. Otherwise, this block returns false.
Note: This block approximates the color detected. Therefore, closely related colors may be register as being detected. An example, "orange" registers as "red".

Example 1: If a Color is detected, then play a note on the Buzzer

Note: this example is performed in online mode.

If you have overwritten the firmware when using "offline mode", please follow the instructions to reset back to "online mode".

Blocks Used
Block Category Blocks
Events MDesigner When Click Green Flag block new.png Info icon.png
Control

MDesigner v1.6 Wait block.png Info icon.png

MDesigner v1.6 Forever block.png Info icon.png

MDesigner v1.6 If block.png Info icon.png

Buggy IBB Buggy icon.png

IBB mDesigner LineFInder Block Test Color NoLabels.png Info icon.png

IBB mDesigner Buzzer Block Play Note NoLabels.png Info icon.png

Example

IBB mDesigner Color Detector Example1.png

Description: When activated, The program will loop forever checking for when Color Detector "A" detects green, then the Buzzer will play note C4 for 1 second.

Block: Read Color

Retrieving the raw value from the Color Detector can be accessed using the Color Detector - Read Color block.

Function: This block reads and returns the raw value from the color detector while having the corresponding ColorLED set to a specific color.

IBB mDesigner LineFinderLED Block Read Color.png
  • Sensor - sensor to read raw value from (either A or B).
  • Color - turn on the corresponding ColorLED to the selected color (either red, green, blue or OFF).
Note: Turning on the corresponding paired ColorLED can help improve the consistency of the raw data readings.

ColorLED "A" and Color Detector "A" are on the same side. Similarly with ColorLED "B" and Color Detector "B".

Example 2: Read and display the raw value from a Color Detector

Note: this example is performed in online mode.

If you have overwritten the firmware when using "offline mode", please follow the instructions to reset back to "online mode".

Blocks Used
Block Category Blocks
Looks MDesigner v1.6 Say block.png Info icon.png
Events MDesigner When Click Green Flag block new.png Info icon.png
Control

MDesigner v1.6 Wait block.png Info icon.png

MDesigner v1.6 Forever block.png Info icon.png

Buggy IBB Buggy icon.png IBB mDesigner LineFinderLED Block Set Color NoLabels.png Info icon.png
Example

IBB mDesigner Color Detector Example2.png

Description: When activated, Corey will say the raw value currently detected on Color Detector "A" with the corresponding ColorLED set to red. Test different color surfaces to see the raw values change. IBB mDesigner Color Detector Example2 running.png