Lesson 8-1: Arduino Code Demonstrating Serial Monitor
In this lecture, we learn about conditional statements such as if, else if, and else, with multiple examples.
539-Lesson 8: Arduino Conditional Statements
Язык: C++
/*
* S01-08
* Conditional Statement 1
Please watch video instructions here https://youtu.be/Mky-04NH_CQ
This code is available at http://robojax.com/course1/?vid=lecture08
with over 100 lectures free on YouTube. Watch it here http://robojax.com/L/?id=338
Get the code for the course: http://robojax.com/L/?id=339
* Written by Ahmad Shamshiri for Robojax, robojax.com https://www.youtube.com/robojaxTV
* at 22:27 on February 7, 2019 in Ajax, Ontario, Canada
*/
int mark = 56;
char grade;
void setup() {
if(mark>=90 && mark<=100){
grade ='A';
}else if(mark>=80 && mark<=89){
grade ='B';
}else if(mark>=70 && mark<=79){
grade ='C';
}else if(mark>=60 && mark<=69){
grade ='D';
}else{
grade ='F';
}
Serial.begin(9600);//initialize the serial monitor
Serial.print("Grade is:");
Serial.println(grade);
}
void loop() {
//Robojax Step-by-Step Arduino Course http://robojax.com/L/?id=338
}
Ресурсы и ссылки
Ресурсов пока нет.
Файлы📁
Нет доступных файлов.