use Libraries.Robots.Lego.Motor use Libraries.Robots.Lego.ColorSensor action Main // drives staright forwards counting black bars on the mat, //stops when it gets to 5 Motor motor ColorSensor color color:SetPort(2) integer num = 0 motor:RotateForward("B") motor:RotateForward("C") repeat until num = 5 repeat until color:GetColor() = "black" end num = num + 1 if num < 5 repeat until color:GetColor() not= "black" end end end motor:Stop("B") motor:Stop("C") end