Lessons → Homework → Homework 14 → Survey to help us form your project team
http://www.rose-hulman.edu/class/csse/resources/Robotics/InstallingCreateSimulator.htm
Add code to the main function that tests your wander function.
Cliff Sensors
This problem requires you to read four sensors and control two LED actuators:
Create a function called cliffSensors() for your work on this problem.
Your task is to read the front left and front right cliff sensors while moving a black line below the sensors. Print out the black line PDF and use it for testing. The location of the black line controls the state of the Play and Advance LEDs.
When the black line is below the front right cliff sensor the Play LED should be off. When the black line is below the left cliff sensor the Advance LED should be off. When the black line is not below the sensor the corresponding LED should be on.
In addition to the LEDs, print out the value of the analog sensor to the computer display using print. In fact you should probably do the printing part first! Since you will need to know where to set the threshold value to decide when the black line is present or absent for the LEDs, you will need to know the range of light and dark values. The values of both sensors should print to the screen every 0.1 seconds using a well formatted print message. For my program it was simply:
Cliff Sensors FL = 80 FR = 720
This line btw was taken while the black line was below the Front Left Cliff Sensor.
Make note of what the white and black values are for your program for each sensor. Personally, I'm curious how much they vary from robot to robot, so remember your values for white and black.
The printing of the cliff sensor values and controlling of the LEDs should continue inside a while loop until the user pushes either the left or right bumper. When a bumper press is observed the program should shutdown the robot and print a Goodbye message to the screen.
Add code to the main function that tests your cliffSensors function.
robot.setLEDs(0,0,0,0) #turn off all of the robot's LEDS
robot.setLEDs(0,255,0,0)#turn on only the robot's power LED to green (see documentation)
robot.setLEDs(0,0,1,0)#turn on only the robot's play LED
You may notice that getting a yellow light from the power LED is not best to use r.setLEDs(128,255,0,0) as you might guess.
Play with it until you find a good yellow.
Add code to the main function that tests your kittLights function.