The past week we have been working with the light sensor. In these activities, our main goal was to be able to find a threshold using the light sensor, get the robot to follow a line using the light sensor, and finally to make it follow the line faster. To find the threshold for the black line and the white to the side of the line, we must go to the NXT view menu and select reflected light. We then get the two values for light and dark. From here, we add up the two values and divide that number by two. Our next task was to get the NXT to follow a line. To do this, we started by mounting the light sensor to the front of the robot. On the programming software, we used a switch block and we selected the light sensor option. The threshold was then entered into the box. The switch block tells the robot to do one thing if it sees a value above the threshold and another thing if it sees a value below the threshold. We put a loop block around this so this behavior would repeat infinitely. We wanted the robot to track the right side of the line so we programmed the robot in the switch block to go right when the robot sees a value below the threshold and left when the robot sees a value above the threshold. The robot slowly inches its way on the line. The power on the motors must also be turned down to make it track properly. This is what the next investigation fixed. The next investigation was all about making the robot track the line faster. In this investigation, the light sensor was put on the back of the robot which was closer to the wheels which meant that the robot didnt have to turn the sensor as far to get a reading. The program for this was almost the same except this time, the robot was going backwards rather than forwards so we set the motor blocks to go backwards. We did a calculation and it took only 73% of the time it would have taken if the sensor were mounted in the front.
No comments:
Post a Comment