LnS1-Testing Line Sensor
| Block Code | Copy and Paste Code |
|
use Libraries.Robots.BirdBrain.Finch Finch finch output "Left Line Sensor: " + finch:GetLine("left") output "Right Line Sensor: " + finch:GetLine("right") finch:Disconnect() |
| This code is used to test the inferred sensors on the bottom of the Finch 2.0.First place the Finch on some white paper. run the code and you should right and left numbers nearing 100. Cover the Finch with a box and you run the code againYou shoud see the same numbers. This is becuse the robot is making it's own infraredlight that you can't see but the sensor ca e 4 infrared are looking just at the black and run the code.This should be a lower number. Using these two nuimber you should be able tomake your robot follow a shape made out of black tape on white paper. | |
| Block Code for LNS2 Follow a Black Tape Line Copy and Paste Code | |
![]() |
use Libraries.Robots.BirdBrain.Finch Finch finch integer rightIR = 0 integer leftIR = 0 number rightSpeed = 25 number leftSpeed = 25 repeat until finch:GetButton("A") output "Right Line Sensor: " + finch:GetLine("right")+" Left " + finch:GetLine("left") rightIR=finch:GetLine("right") leftIR = finch:GetLine("left") finch:SetMotors(rightSpeed,leftSpeed) if leftIR<20 leftSpeed=leftSpeed-25 end if rightIR<20 rightSpeed=rightSpeed-10 end finch:SetBeak(100,0,0) finch:Pause(1) finch:SetBeak(0,100,0) end finch:StopAll() finch:Disconnect() |
|
First make a raced track using Black and a large sheet of white paper. You make make a square, circle, ovel, or any other shape you want like a flower or a. letter. Use the 3/4 to 1 inch black. You want it to have good contrast. You will need to correct the If statements depoending and the data you gathered in the Testing Line sensor. There are lots of ways to make this work. When the Infrared sensor sees lots reflex back (WHITE) you need to turn the robot away from the light. When it see Back with both sensors it should just move forward. The is also a logial error in this progam. You mission is to find and correct this error. I will post the correct code here. |
|
