0
0
Arduinoprogramming~10 mins

Using multiple libraries together in Arduino - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to include the Wire library for I2C communication.

Arduino
#include [1]
Drag options to blanks, or click blank then click option'
A<SPI.h>
B<Wire.h>
C<Servo.h>
D<EEPROM.h>
Attempts:
3 left
💡 Hint
Common Mistakes
Including SPI.h instead of Wire.h
Forgetting the angle brackets <> around the library name
2fill in blank
medium

Complete the code to initialize the Serial communication at 9600 baud.

Arduino
void setup() {
  Serial.[1](9600);
}
Drag options to blanks, or click blank then click option'
Abegin
Binit
Cstart
Dopen
Attempts:
3 left
💡 Hint
Common Mistakes
Using Serial.start instead of Serial.begin
Using Serial.init which does not exist
3fill in blank
hard

Fix the error in the code to read data from the Wire library.

Arduino
Wire.[1]();
int data = Wire.read();
Drag options to blanks, or click blank then click option'
ArequestFrom
BendTransmission
CbeginTransmission
Dwrite
Attempts:
3 left
💡 Hint
Common Mistakes
Using write instead of requestFrom
Using beginTransmission when reading data
4fill in blank
hard

Fill both blanks to send data using SPI library.

Arduino
SPI.[1]();
SPI.[2](0xFF);
Drag options to blanks, or click blank then click option'
Abegin
Btransfer
Cend
Dwrite
Attempts:
3 left
💡 Hint
Common Mistakes
Using SPI.write which is not a standard SPI function
Forgetting to call SPI.begin before transfer
5fill in blank
hard

Fill all three blanks to initialize Servo and set its position.

Arduino
#include <Servo.h>
Servo [1];
void setup() {
  [1].[2](9);
  [1].[3](90);
}
Drag options to blanks, or click blank then click option'
AmyServo
Battach
Cwrite
Dbegin
Attempts:
3 left
💡 Hint
Common Mistakes
Using begin() instead of attach() for Servo
Not naming the Servo object