Skip to content

Instantly share code, notes, and snippets.

@lazytomatolab
Created September 27, 2017 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazytomatolab/a176df60423aa2db63a3c3ebec878d4b to your computer and use it in GitHub Desktop.
Save lazytomatolab/a176df60423aa2db63a3c3ebec878d4b to your computer and use it in GitHub Desktop.
【Arduino SpeedUp】快速上手 Class 11 - Serial monitor 讀心術!更多資訊請造訪:http://www.lazytomatolab.com
void setup() {
Serial.begin(115200);
Serial.println("Hello! This is LazyTomato Lab!");
delay(1000);
Serial.println("Please visit: http://www.lazytomatolab.com/");
}
void loop() {
}
int universe = 42;
void setup() {
Serial.begin(115200);
Serial.print("The answer to life, the universe, and everything: ");
Serial.print(universe);
Serial.print(".");
}
void loop() {
}
void setup() {
Serial.begin(115200);
}
void loop() {
if(Serial.available()) {
int num = Serial.parseInt();
Serial.print("The temperature is: ");
Serial.print(num * 9 / 5 + 32);
Serial.println(" °F");
}
}
void setup() {
Serial.begin(115200);
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
}
void loop() {
if(Serial.available()) {
char ch = Serial.read();
if(ch == 'O') {
digitalWrite(13, HIGH);
}
else if(ch == 'C') {
digitalWrite(13, LOW);
}
else {
Serial.println("Invalid character.");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment