Quiz Answers | Foundation of 国产男女猛烈无遮挡免费视频 | Age 10-15
What pin numbers control the SPEED of the robot? (Multiple Choice)
11,3
Let’s say we connected an Infra-red (IR) sensor to pin number 2. What is value going to be on pin number 2 when the sensor is close to a BLACK coloured wall?
1 or HIGH
Explanation – Black is a good absorber of light even if the black wall is in front of the sensor, the black colour will not reflect the light back and sensor will have the value HIGH.
Suppose you are making an autonomous robot for a competition. There are two members in your team, you and your team-mate. For the entire duration of the project you worked on the coding part of the robot and your other teammate worked on the circuits. On the final day of the competition, your team-mate is not able to make it for the demonstration. You are required to plug in the main power chords of the robot. You see two wires red and black coming out from the main power supply(battery box). Which wire would you connect to the positive terminal? Red or Black?
Red
Explanation – red is always going to be the positive or live wire
This question requires you to write code. Connect the IR sensor to pin Number 2 (may already be connected) and plug-in an LED to pin 5 and 6. The LED should stay off if there is nothing in front of the sensor. Each time I bring my hand close to the sensor, the LED connected to pin 5 and 6 should flash 3 times before turning off. Try that in your robot and paste your code below.
void setup() {
pinMode(2,INPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
}
void loop() {
if (digitalRead(2) == HIGH)
{
LED_off();
}
if (digitalRead(2) == LOW)
{
LED_on();
delay(100);
LED_off();
delay(100);
LED_on();
delay(100);
LED_off();
delay(100);
LED_on();
delay(100);
LED_off();
delay(100);
}
}
void LED_on()
{
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
}
void LED_off()
{
digitalWrite(5,LOW);
digitalWrite(6,LOW);
}
Try to 国产男女猛烈无遮挡免费视频网站 your robot to follow the black line. Hint is hidden inside number 3. To do this we need to set the sensors facing to the ground.
void setup() {
pinMode(2,INPUT); // right sensor pin 2
pinMode(4,INPUT); // left sensor pin 4
pinMode(12,OUTPUT);
pinMode(13,OUTPUT);
pinMode(11,OUTPUT);
pinMode(3,OUTPUT);
}
void loop() {
if (digitalRead(2) == LOW and digitalRead(4) == LOW) // when both the sensors senses white surface
{
forward();
}
if (digitalRead(2) == LOW and digitalRead(4) == HIGH) // when left sensor senses black line
{
left();
}
if (digitalRead(2) == HIGH and digitalRead(4) == LOW) // when right sensor senses black line
{
right();
} if (digitalRead(2) == HIGH and digitalRead(4) == HIGH) // when both the sensor sensor black surface
{
stopRobot();
}
}
void forward()
{
digitalWrite(12,HIGH);
digitalWrite(13,HIGH);
analogWrite(3,100);
analogWrite(11,100);
}
void backward()
{
digitalWrite(12,LOW);
digitalWrite(13,LOW);
analogWrite(3,100);
analogWrite(11,100);
}
void stopRobot()
{
analogWrite(3,0);
analogWrite(11,0);
}
void left()
{
digitalWrite(12, HIGH);
digitalWrite(13,LOW);
analogWrite(3,100);
analogWrite(11,100);
}
void right()
{
digitalWrite(12,LOW);
digitalWrite(13,HIGH);
analogWrite(3,100);
analogWrite(11,100);
}
