Question: Please see the Arduino code below as the basis for bot movement: / / code starts here const int AIN 1 = 1 1 ;
Please see the Arduino code below as the basis for bot movement:
code starts here
const int AIN;
const int AIN;
const int PWMA ;
const int BIN;
const int BIN;
const int PWMB ;
void setup
pinModeAIN OUTPUT;
pinModeAIN OUTPUT;
pinModePWMA OUTPUT;
pinModeBIN OUTPUT;
pinModeBIN OUTPUT;
pinModePWMB OUTPUT;
void loop
pause for secondget ready!
delay;
Forward
digitalWriteAIN LOW;
digitalWriteAIN HIGH;
digitalWriteBIN LOW;
digitalWriteBIN HIGH;
analogWritePWMA;
analogWritePWMB;
delay;
analogWritePWMA;
analogWritePWMB;
delay;
Turn one way or the other
digitalWriteAIN LOW;
digitalWriteAIN HIGH;
digitalWriteBIN LOW;
digitalWriteBIN HIGH;
analogWritePWMA;
analogWritePWMB;
delay;
analogWritePWMA;
analogWritePWMB;
delay;
Reverse
digitalWriteAIN LOW;
digitalWriteAIN HIGH;
digitalWriteBIN LOW;
digitalWriteBIN HIGH;
analogWritePWMA;
analogWritePWMB;
delay;
analogWritePWMA;
analogWritePWMB;
infinite while loop to stop the program
while true
delay;
Can the coding above for bot movement be utilized in conjunction with the problem below:
Objectives Follow arbitrary lines of various colors.
Introduction You will need an Arduino robot which is able to
Drive around on the table by itself.
Respond to light from the photoresistor
Display useful information on the LCD
Respond to a button
The photoresistor needs to be within about one finger width off the table facing down, there are various ways to do this, but you almost for sure need to extend the wire lead length. To increase sensitivity of the photoresistor, it also helps to reduce stray light, this can be done with a black paper tube, I have paper and tape available for this during class. Construction of the Color sensor is shown below: Spliced and soldered wires to extend the light sensor could look like this: Insulate one or both legs Wrap a tight black paper tube to from the end If you have not installed the battery pack between the wheels to improve traction, this would be a good time to move it forward. If the wheels slip during turns, accurate line tracking will be more difficult. The color duct tape your bot will follow is higher friction than the table surface and tends to catch the paperclip tail drag; making repeatability problematic.
Requirements
The first problem is to find suitable light values for white tape, red tape, yellow tape, green tape, and black tabletop surface ie you are calibrating the Light sensor to act as a Color sensor Once you know these values, you will be able to program your bot to recognize these colors and make specific actions based on that information. Read and remember this: sensing color is not easy, you need to control things such as the distance your sensor is from the table, angle your sensor has to the table, ambient light, shadows from you or other students hovering over your bot, and various other factors.
Consistency of your robot depends on you making measurements which are consistent with what the robot will see. When your bot seems to no longer sense colors correctly you may need to recalibrate. Build your bot capable of movement, but in this first task, just place your bot manually. Your bot should display the analog output of the LightColor sensor to the LCD. Record values from various places on the tabletop black and colored tapes.
Adjust your light sensor to try and achieve the largest differenceseparation between the colors. Find the minimum and maximum values for all the different colors. Then graph them on a numberline below. If light values overlap for different colors, try to adjust your sensor andor reread the previous paragraph. Find maximum and minimum values which are unique for each color. Dont be approximate, dont hurry, take lots of data.
Place the Bot at one corner on the outeredge of the white tape. The bot should wait until you start it with a button push. The Bot must follow the outeredge of the white tape. It must follow around corners, although it can swing out, it must not reverse direction or hit a wall. For signoff, you must complete at least one lap without crossing over the tape outer edge to inner edge or hitting a wall.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
