tes1 Flashcards
- Which one of the following statements concerning the ports on an Arduino is incorrect?
(a) The PIN register reads the logic levels at a port’s input pins.
(b) There are four ports on an Arduino Uno, referred to as Port A, Port B, Port C and Port D
(c) Each port is controlled by just three registers
(d) The PORT register is used to set a pin high, or low
(e) The DDR register is used to specify if a pin is to be used as an output, or an input.
B
- The following section of a sketch contains an error. Which one of the following statements best
describes what the error is?
void setup() { DDRD = B01101010; }
void loop() { PORTD = B10101000; }
(a) Pin 3 in the DDRD is incorrectly specified
(b) Pin 5 in the DDRD is incorrectly specified
(c) Pin 6 in the DDRD is incorrectly specified
(d) Pin 7 in the DDRD is incorrectly specified
(e) None of the above
________________________
D
- Which one of the following statements is correct?
(a) Any 8 pins on the digital port can be used by port D apart from pins 0 and 1
(b) The instruction DDRD 01011010; will set some lines as inputs and others as outputs
(c) The DDRD instruction must be placed at the top of a sketch above both setup() and loop()
(d) PIND returns the pin configuration of port D
(e) None of the above
E
- Which one of the following statements is incorrect regarding the mapping function map()?
(a) The mapping function requires 5 parameters when it is used.
(b) Only one mapping function can be used in a sketch
(c) The input and output ranges of the function map() can contain both positive and negative numbers.
(d) The mapping function will only return integer numbers.
(e) The mapping function can have an output range that is greater than its input range.
B
- Which one of the following statements is incorrect regarding the servo motor (SM-S2309S) used
for the exercise questions?
(a) The servo motor can only rotate through a limited number of degrees.
(b) The fixed angular rotation of a servo motor is typically between 0 and 180 degrees.
(c) The servo motor has a number of wires connected to it. One wire is used to send signals to make it
rotate clockwise, another wire is used to send signals to make the servo motor rotate anti-clockwise
and the remaining 2 wires are used to provide power, to drive the motor.
(d) It is possible to connect more than one servo motor to an Arduino Uno.
(e) The servo motor can be driven directly from the digital port, without the need for any additional driver
chips, or driver boards.
C
- Which one of the following statements about the inclusion of functions in a sketch is incorrect?
(a) The keyword return must be used when a function is to return a value.
(b) A function can be passed one, or more parameters when it is called.
(c) All functions must be defined within the setup() section of a sketch.
(d) A function can be made to return a value when it is called.
(e) A function can be written that does not expect parameters to be passed to it when it is called.
C
. Which one of the following statements about driving a servo motor using the sketch below is
incorrect?
#include Servo servoMotor;
void setup() { servoMotor.attach(3); }
void loop() { servoMotor.write(-10); delay(100); servoMotor.write(0); delay(100); }
(a) #include will import a pre-built servo script from the Arduino library.
(b) Servo servoMotor; creates an instance of the servo object.
(c) servoMotor.attach(3); will inform the servo script that the servo motor is connected to pin 3 of the
digital port.
(d) servoMotor.write(-10); will rotate the servo motor output shaft 10 degrees anticlockwise
(e) A delay of 100ms is used to ensure the servo motor output shaft reaches its destination.
D
. Which one of the following statements is incorrect?
(a) A stepper motor can be manufactured to be either unipolar, or bipolar.
(b) Stepper motors can rotate both clockwise and anticlockwise, but only one step at a time.
(c) It is impossible to change the speed at which a stepper motor rotates, since the step angle is fixed.
(d) The three common drive modes for stepper motors are: - Wave Drive, Full Step and Half Step.
(e) With Full Step Drive, 2 of the coils in a stepper motor are always activated, unlike Wave Drive, which
only activates 1 coil.
C
. Given the following correctly written sketch, which one of the following statements is incorrect?
//=========================================
void setup() { Serial.begin(9600);
}
//========================================= void loop() {
int adcValue = analogRead(0); float newNumber = calcAnswer(adcValue); Serial.println(newNumber);
}
//========================================= float calcAnswer(int voltage){ int result; result = map(voltage,0,1023,200,300); return float(result);
}
(a) Variable result is a local variable.
(b) Variable newNumber will hold an integer number between 0 and 1023.
(c) Numbers between 200 and 300 will be printed in the Serial Monitor window.
(d) Variable voltage is a local variable.
(e) The function calcAnswer will be called more than once when the sketch is running.
B
- Which one of the following statements concerning interrupts is incorrect?
(a) The 2 different types of interrupt are external and internal
(b) An interrupt cannot be called by an instruction in setup()
(c) An interrupt cannot be called by an instruction in loop()
(d) Only external interrupts require an interrupt service routine
(e) A timer can be used as an internal interrupt.
D
- Which one of the following statements concerning interrupts is incorrect?
(a) There is a maximum of 2 external interrupts on the Arduino Uno
(b) Digital lines 2 and 3 can only be used for external interrupts.
(c) External interrupts can be triggered by one of 4 modes
(d) Interrupts can be disabled, or enabled by code in either setup() or loop()
(e) External interrupts can be triggered by the voltage on the interrupt pin going negative, going low, falling,
rising, or changing.
E
- Which one of the following statements regarding ultrasonic range detection modules is incorrect?
(a) The module measures distance using the pulse time of flight technique
(b) The emitted pulse is referred to as a chirp and the received pulse the echo
(c) The pulseIn() function can be used to detect the echo pulse
(d) The pulseIn() function will return a long integer number in milliseconds.
(e) The pulseIn() function has an optional parameter called timeout, which stops looking for an echo pulse
after a given time period.
D
- Which one of the following statements regarding capacitive inputs is incorrect?
(a) Charge and discharge times can be measured by code from the library CapacitiveSensor, after it has
been included in your sketch
(b) A touch sensor requires the use of 2 digital pins and a resistor
(c) The sensor works by looking at the time taken to charge and discharge a pin.
(d) A person touching a specific pin on the port increases the capacitance and hence extends the charge
and discharge times.
(e) Only 2 capacitive inputs can be used on an Arduino Uno
E
6
14. Which one of the following statements regarding interfacing devices to the digital pins of an Arduino
Uno is incorrect?
(a) The largest wattage device the Arduino Uno can directly drive is approximately 1W
(b) A mechanical relay, or solid state relay can be used to control both high current and/or high voltage
devices
(c) Solid state relays operate at much higher frequencies than mechanical types
(d) Some types of solid state relay optically isolate the Arduino from the circuit it is controlling.
(e) When driving a MOSFET from a digital pin it is advisable to put a resistor to ground to ensure the device
is fully switched off when not in use.
A
15. Given that a LCD module is connected to an Arduino with the instance name of myLCD, which of the following statements is incorrect?
(a) myLCD.write() can be used to send text to the display module
(b) myLCD.print() can be used to send text to the display module
(c) myLCD.write() will only send text to the display module
(d) myLCD.print() will only send text to the display module
(e) myLCD.write(“Hello”); will print the text “Hello” on the display module
D