IR Seeker Video Lesson #1

QikEasy IR Seeker Tutorials – Video #1

This video provides a basic tutorial on how to use QikEasy IR Seeker.

Here’s the Word Block program for the first part of the tutorial (for Spike App 3):

Here’s the Python code for part 1 of the tutorial (for Spike App 3):

from hub import light_matrix, port
import runloop
import color_sensor

# IR Seeker Read Function
def IrReadDirection(Channel):
    return round(color_sensor.reflection(Channel) // 4)
    
# MAIN PROGRAM
async def main():
    while (1):
        Direction = IrReadDirection(port.C)
        light_matrix.write(str(Direction))
        await runloop.sleep_ms(200)

runloop.run(main())

Here’s the Word Block program for the second part of the tutorial (for Spike App 3):

Here’s the Python code for part 2 of the tutorial (for Spike App 3):

from hub import light_matrix, port
import runloop
import color_sensor

# IR Seeker Read Function
def IrReadDirection(Channel, ReductionFactor):
    rgb = color_sensor.rgbi(Channel)
    # note that rgb[0] is the raw red value
    return round(color_sensor.reflection(Channel) // 4), round(rgb[0]//ReductionFactor)

# MAIN PROGRAM
async def main():
    while (1):
        Direction_n_Strength = IrReadDirection(port.C, 4)
        Strength = Direction_n_Strength[1]//2
        if Strength>100:
            Strength = 100
        light_matrix.write(str(Direction_n_Strength[0]), Strength)
        await runloop.sleep_ms(200)

runloop.run(main())