Download presentation
Presentation is loading. Please wait.
Published byBrice Jordan Modified over 9 years ago
1
ECE 002 Robots and Sensors Group 14
2
Objectives Research sensors and their usefulness to analyze data Research sensors and their usefulness to analyze data Design more advanced robot from last semester Design more advanced robot from last semester Gain a better understanding of MATLAB and functions Gain a better understanding of MATLAB and functions
3
Parts List The Handyboard Light Sensors X2 Motors X2 Legos!
4
The Code void main() void main() { int flag=0 int flag=0 while(!start_button()); // Wait until start button is pressed while(!start_button()); // Wait until start button is pressed while(flag=0) // Continue infinitely while(flag=0) // Continue infinitely { if((analog(2)<240) && analog(4)<240) // If both sensors read less than 240: if((analog(2)<240) && analog(4)<240) // If both sensors read less than 240: { { motor(1,100); // Motor 1 forward at 100% motor(1,100); // Motor 1 forward at 100% motor(3,100); // Motor 3 forward at 100% motor(3,100); // Motor 3 forward at 100% flag=0; // Flag still equals 0 flag=0; // Flag still equals 0 } } else if ((analog(2)>240) && (analog(4)>240)) // If both sensors are > 240: else if ((analog(2)>240) && (analog(4)>240)) // If both sensors are > 240: { { ao(); // Turn off both motors ao(); // Turn off both motors flag=1; // Flag equals 1, exiting while loop flag=1; // Flag equals 1, exiting while loop } } else if ((analog(2)>240) && (analog(4) 240) && (analog(4)<240)) /* If sensor 2 is greater than 240 and sensor 4 is less than 240 and sensor 4 is less than 240: /* 240: /* { { motor(1,100); // Motor 1 forward at 100% motor(1,100); // Motor 1 forward at 100% motor(3,-100); // Motor 2 reverse at 100% motor(3,-100); // Motor 2 reverse at 100% flag=0; // Flag still equals 0 flag=0; // Flag still equals 0 } } else if ((analog(4)>240) && (analog(2) 240) && (analog(2)<240)) /* If sensor 4 is greater than 240 and sensor 2 is less than 240 and sensor 2 is less than 240: /* 240: /* { { motor(1,-100); // Motor 1 reverse at 100% motor(1,-100); // Motor 1 reverse at 100% motor(3,100); // Motor 3 forward at 1200% motor(3,100); // Motor 3 forward at 1200% flag=0; // Flag still equals 0 flag=0; // Flag still equals 0 } } { { ao() ao() }
5
Sensor and Program Outline Light sensors differentiated between light and dark Light sensors differentiated between light and dark Handyboard analyzed data and made decision whether or not to turn Handyboard analyzed data and made decision whether or not to turn Followed S-curve to end finish Followed S-curve to end finish At finish, both light sensors were on dark line, robot turned off At finish, both light sensors were on dark line, robot turned off
6
Design Process Program and design team Program and design team No prototype robot No prototype robot Small test programs to test threshold and motor speed Small test programs to test threshold and motor speed Full program came from test programs Full program came from test programs
7
Sensors Sensors tested for best one Sensors tested for best one Light sensor was better at differentiating light and dark Light sensor was better at differentiating light and dark Made it easy to set threshold and let robot know when to turn Made it easy to set threshold and let robot know when to turn
9
MATLAB Learned how to incorporate functions into programs Learned how to incorporate functions into programs Used trapez and trapez_fast Used trapez and trapez_fast Trapez_fast was faster because it used vector operations in MATLAB Trapez_fast was faster because it used vector operations in MATLAB Functions used to find and plot data points for integral of sin(x) Functions used to find and plot data points for integral of sin(x)
10
MATLAB Graphs Sin(x)- blue Sin(x)- blue Integral sin(x)- red Integral sin(x)- red Shows how functions can be used and then graphed in MATLAB Shows how functions can be used and then graphed in MATLAB
11
Conclusions Sensors can be used to collect data but some are better at different functions Sensors can be used to collect data but some are better at different functions The robot helped reinforce our programming, building, and teamwork skills The robot helped reinforce our programming, building, and teamwork skills MATLAB is a great tool to use to analyze data quickly MATLAB is a great tool to use to analyze data quickly
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.