Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
RoboCircuits
Published © CC BY-NC-SA

Line Follower Robot using Pico

Raspberry Pi Pico Projects

IntermediateFull instructions provided3 hours5,112
Line Follower Robot using Pico

Things used in this project

Hardware components

Raspberry Pi Pico
Raspberry Pi Pico
×1
Arduino UNO
Arduino UNO
×1

Software apps and online services

VS Code
Microsoft VS Code

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Solder Flux, Soldering
Solder Flux, Soldering

Story

Read more

Schematics

Schematics

Code

LFR

MicroPython
from machine import Pin
import time

in1 = Pin(2, Pin.IN)  
in2 = Pin(3, Pin.IN)  

m11 = Pin(4, Pin.OUT)  
m12 = Pin(5, Pin.OUT)  
m21 = Pin(6, Pin.OUT)  
m22 = Pin(7, Pin.OUT)  

while True:             
    sensor1 = in1.value()
    sensor2 = in2.value()
    if sensor1 == 1:
        if sensor2 == 1:
            m11.value(0)
            m12.value(1)
            m21.value(0)
            m22.value(1)
        elif sensor2 == 0:
            m11.value(0)
            m12.value(0)
            m21.value(0)
            m22.value(1)
    elif sensor1 == 0:
        if sensor2 == 1:
            m11.value(0)
            m12.value(1)
            m21.value(0)
            m22.value(0)
        else:
            m11.value(0)
            m12.value(0)
            m12.value(0)
            m22.value(0)

Credits

RoboCircuits
37 projects • 219 followers
YouTuber, Explorer, Creator, Programmer, Arduino Lover and Engineer

Comments