Worksheets5 . Input Control LED
Total questions: 10
Worksheet time: 5mins
Which function is used to initialize serial communication in an Arduino sketch?
Serial.begin()
Serial.start();
Serial.Begin();
Serial.begin();
What baud rate is commonly used for serial communication with the Arduino Serial Monitor?
Which function is used to print data to the Serial Monitor?
Which function reads incoming serial data from the Serial Monitor?
Serial.read()
Serial.transmit()
What type of data does the "Serial.read() "function return?
character
Which function is used to check if data is available to read from the Serial Monitor?
How can you print a new line after printing data to the Serial Monitor?
Which of the following is a correct way to initialize serial communication at 9600 baud in the setup function?
How can you send the string "Hello, World!" to the Serial Monitor?
Choose the correct option
if(Serial.available() > 0)
{
char state = Serial.read()
if(state == '1'){
digitalWrite(led,HIGH);}
if(state == '0'){
digitalWrite(led,LOW);}
}
if(Serial.available() > 0)
{
char state = Serial.read()
if(state == 'a'){
digitalWrite(led,HIGH);}
if(state == 'b'){
digitalWrite(led,LOW);}
}
if(Serial.available() > 0)
{
char state = Serial.read()
if(state == 1){
digitalWrite(led,HIGH);}
if(state == 0){
digitalWrite(led,LOW);}
}
if(Serial.available() > 0)
{
char state = Serial.read()
if(state == a){
digitalWrite(led,HIGH);}
if(state == b){
digitalWrite(led,LOW);}
}
