Answer Key
- Arduino is an open-source prototype platform based on easy-to-use hardware and software. Its two primary components are a programmable circuit board (the microcontroller) and a ready-made software called the Arduino IDE (Integrated Development Environment), which is used to write and upload code to the physical board.
- The setup() function is called once when a sketch starts and is used to initialize variables, pin modes, and libraries. The loop() function runs consecutively after setup() completes, allowing the program to change, respond, and actively control the Arduino board.
- Local variables are declared inside a function or block and can only be used by statements within that specific function or block. Global variables are defined outside of all functions, usually at the top of the program, and can be accessed by any function throughout the entire program.
- An Arduino UNO board can be powered by using a USB cable connected from a computer to the board’s USB connection. Alternatively, it can be powered directly from an AC mains power supply by connecting it to the Barrel Jack on the board.
- Pulse Width Modulation (PWM) is a technique used to vary the width of pulses in a pulse-train, which can create a fading effect or control motor speed. The analogWrite() function is used to write an analog value as a PWM wave to a specific pin.
- The two types of strings are character arrays (c-style strings) and the String object. The String object is easier to use with built-in functions for manipulation, while character arrays are more memory efficient but require more manual manipulation. The main disadvantage of the String object is that it uses a lot of memory, which can cause an Arduino to hang, crash, or behave unexpectedly.
- An H-Bridge is an electronic circuit that can drive a DC motor in both forward and backward directions. The source text specifically mentions using the L298 H-Bridge IC to control the speed and direction of DC motors.
- To find the correct serial port, you should go to the Tools → Serial Port menu. You can identify the correct port by disconnecting the Arduino board, re-opening the menu to see which entry disappears, and then reconnecting the board and selecting that port.
- The TX (transmit) and RX (receive) LEDs indicate serial communication activity. The TX LED flashes when the board is sending serial data, with the speed depending on the baud rate. The RX LED flashes during the data receiving process.
- An Interrupt Service Routine (ISR) is a special function that is executed automatically when a specific event, such as a state change on a digital pin, occurs, interrupting the main program. To ensure variables shared between an ISR and the main program are updated correctly, they should be declared as volatile.