Challenge - 5 Problems
Bluetooth Mastery with HC-05/HC-06
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output on Serial Monitor?
Consider this Arduino code using HC-05 Bluetooth module. What will be printed on the Serial Monitor when the module receives the character 'A' from a paired device?
Arduino
void setup() {
Serial.begin(9600); // Serial Monitor
Serial1.begin(9600); // HC-05 module
}
void loop() {
if (Serial1.available()) {
char c = Serial1.read();
if (c == 'A') {
Serial.println("Received A");
} else {
Serial.println("Other char");
}
}
}Attempts:
2 left
💡 Hint
Check what happens when Serial1 reads 'A'.
✗ Incorrect
The code reads from Serial1 (HC-05). If the character is 'A', it prints 'Received A' on Serial Monitor.
❓ Predict Output
intermediate2:00remaining
What will be the output of this code snippet?
This Arduino sketch reads data from HC-06 module and echoes it back. What will be printed on Serial Monitor if the paired device sends 'Hello'?
Arduino
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
}
void loop() {
while (Serial1.available()) {
char c = Serial1.read();
Serial.print(c);
Serial1.print(c);
}
}Attempts:
2 left
💡 Hint
Look at how characters are read and printed.
✗ Incorrect
The code reads each character from Serial1 and prints it to Serial Monitor and back to Serial1, so 'Hello' is printed as is.
❓ Predict Output
advanced2:00remaining
What error does this code produce?
This code tries to initialize HC-05 module but has a mistake. What error will occur when compiling?
Arduino
void setup() {
Serial.begin(9600);
Serial1.begin(38400); // Missing semicolon fixed
}
void loop() {}Attempts:
2 left
💡 Hint
Check punctuation at the end of lines.
✗ Incorrect
The line 'Serial1.begin(38400)' misses a semicolon, causing a syntax error.
🧠 Conceptual
advanced1:30remaining
Which statement about HC-05 and HC-06 modules is correct?
Choose the correct statement about HC-05 and HC-06 Bluetooth modules.
Attempts:
2 left
💡 Hint
Think about flexibility of module roles.
✗ Incorrect
HC-05 supports master and slave modes; HC-06 supports only slave mode.
🚀 Application
expert2:30remaining
How many bytes will be stored in buffer after this code runs?
Given this Arduino code snippet reading from HC-05, how many bytes will be stored in the buffer array after receiving the string 'BT123'?
Arduino
char buffer[10]; int index = 0; void loop() { while (Serial1.available()) { char c = Serial1.read(); if (c == '\n') break; buffer[index++] = c; } }
Attempts:
2 left
💡 Hint
Count characters before newline.
✗ Incorrect
The string 'BT123' has 5 characters; no newline received yet, so all 5 are stored.