Using two line sensors to estimate the position over the line

See Drive document

Pin connections for (New Piggyback) board 1/12/2022

    Peripheral Physical
Pin
GPIO
Number
Notes
   Pushbutton29221 = push. PULL-DOWN
   On-Board LED-none25Pin(25,Pin.OUT)
   Side Main-board LED2721Pin(21,Pin.OUT)
   Right Line sensor LED118Pin(8,Pin.OUT)
   Left Line sensor LED1713Pin(13,Pin.OUT)
   Trigger For Wall sensor1914Pin(14,Pin.OUT)
 
   Left (line) sensor3227ADC 1 ADC(Pin(27))
   Right (line) sensor3126ADC 0 ADC(Pin(26))
   Stop sensor3428ADC 2 ADC(Pin(28))
 
   Switch 110ON = Gnd, PULL-UP
   Switch 221ON = Gnd, PULL-UP
   Switch 342ON = Gnd, PULL-UP
   Switch 453ON = Gnd, PULL-UP
 
   Left Motor Dir129Pin(12,Pin.OUT)
   Left Motor PWM1511
   Right Motor Dir1410Pin(14,Pin.OUT)
   Right Motor PWM1612
 
   UART Tx2116
   UART Rx2217

Imports required
from machine import Pin, ADC, PWM, UART
import time,utime

Link to Drive doc: