Could you help me to solve this questions

profileQas22sim

* Your name _______________

 * Please save your program as YourFirstNameLastName_mid2016.

 

 */

#include <Servo.h>                           // Include servo library

 

void forward(unsigned int time);             //full speed forward for a duration of time (ms)

Servo servoLeft;                             // Declare left and right servos

servo servoRight;

 

void setup() {

  servoLeft.attach(11);                     // Attach left servo to pin 11

  servoRight.attach(12)                     // Attach right servo to pin 12

  DDRB |=OxO2;                              //set pin direction properly

}

 

void loop() {

  char currentStatus;

 

  currentStat = (PinB && 0x1);  //check the status of pin 13

  if (currentStatus =1)

  {

  //display message

  //turn on LED connected to pin 8  

  //robot move forward for half second

  //turn off LED connected to pin 8

  //robot move forward for half seond

  }

  else  //complete more code 

}

}

 

void Forward(unsigned int time)              // Full-speed Forward function

{

  servoLeft.writeMicroseconds(1700);         // Left wheel counerclockwise

  servoRight.writeMicroseconds(1300);        // Right wheel clockwise

  delay(time);                               // Maneuver for time ms

}

 

void backward(unsigned int time);             // Full-speed Backward function

{

  servoLeft.writeMicroseconds(1300);         // Left wheel clockwise

  servoRight.writeMicroseconds(1700);        // Right wheel counterclockwise

  delay(time);                               // Maneuver for time ms

}

  • 10 years ago
  • 15
Answer(0)
Bids(0)