Remote control car with voltage drop

So my partner and I need help; We are working on a final project that is intended for electrical engineering. Our problem, no one knows a lot of programming in the classroom. We need help or some general ideas on how to program this.

Project:

We have a monster truck with two infrared (infrared) sensors that detect its path through voltage. with this we use the free scale diagram as “brains”, along with this we have a “deaf” shoe for firing at open doors (we need to program to note the voltage drop from the IR sensors.

Programming:

We are trying and struggling to create code for this.

  • we need a delay function at the beginning of the program to install the monster truck on the ground, after we need to follow a straight line from the established voltage standard, which IR sensors read on the ground.
  • As he walks, he will have a big drop drop, while he passes through the open door, we need him to stop the shooting, and then follow it.

I know that there is a lot to ask, but we really need help, our teacher, although wise for his years in all electricity (reminds me of a document from the future to the future), c programming is not enough and not too many of them have great knowledge for using C. programming skills. Finally, as soon as we get this work (mid-May), I will post a video, if possible, and show you all. I appreciate any input and any ideas for this, thank you all for your time!

+3
source share
3 answers

Your code will probably look like this:

  // Give yourself some time to set the robot down
  <sleep_for_some_interval>;

  // Keep reading the sensors and reacting until
  // some amount of time passes, or a button is pressed, etc.
  while(<keep_running_condition>)
  {
     // Update sensor readings
     int leftDist = <ConvertToDistance>(<read_left_voltage>);
     int rightDist = <ConvertToDistance(<read_right_voltage>);

     // React to sensor readings
     if(leftDist > <door_threshold> && 
        rightDist > <door_threshold>)
     {
         // A door has been detected.
         <stop>
         <shoot>
         <move_forward_fixed_amount>
     } 
     else if(leftDist > <turn_threshold>) 
     {
         // Left distance is beyond the threshold, 
         // need to turn left
         <turnLeft>;
     } 
     else if(rightDist > <turn_threshold>) 
     {
         // Right distance is beyond the threshold,
         // need to turn right
         <turnRight>
     } 
     else (<terminate_condition>) 
     {
         // Something happened (a sensor condition, etc)
         // that tells us that we need to end
         // the program
         break; // This will exit the while loop
     } 
     else (...) 
     {
         // Other conditions...
     } 
     else 
     {
         // Default reaction (happens if none of the previous 
         // conditions are met)
         <goForward>
     }
  }

  // Shutdown the robot
  <stop>
  // ...

, , , , , , .

/:

  • "... ", - sleep/usleep
  • , ( ). , "turnLeft" , , , .
  • , . ( , , , )
  • ,
  • , (, ) .
  • - , , . , , .
+5

, , ? , , , , 1- , . , , , .

- , ? , , , , . (/ , ), , .

# 2 . , 0 () 1 (). 2 (). , , 2 ( ) 3 (), . 1 , 3.

+4

( , ) - , , - ? - uni, , .

Being that it is a physical project that you have, you really want someone there to be “on the ground” with you, so to speak.

0
source

Source: https://habr.com/ru/post/1706008/


All Articles