Skip to content

Instantly share code, notes, and snippets.

View lazytomatolab's full-sized avatar

LazyTomato Lab 懶番茄工作室 lazytomatolab

View GitHub Profile
@lazytomatolab
lazytomatolab / Class_14_1.ino
Last active August 7, 2019 04:03
【Arduino SpeedUp】快速上手 Class 14 - 迴圈 while 稱霸 Arduino!更多資訊請造訪:http://www.lazytomatolab.com
void setup() {
pinMode(7, INPUT);
digitalWrite(7, HIGH);
pinMode(13, OUTPUT);
while(digitalRead(7) == HIGH) {
digitalWrite(13, HIGH);
delay(200);
digitalWrite(13, LOW);
delay(200);
@lazytomatolab
lazytomatolab / Class_13_1.ino
Created December 23, 2018 12:20
【Arduino SpeedUp】快速上手 Class 13 - 迴圈 for 讓你功力大提升!更多資訊請造訪:http://www.lazytomatolab.com
void setup() {
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
for(int counter = 0; counter < 10; counter++) {
digitalWrite(13, HIGH);
delay(200);
digitalWrite(13, LOW);
delay(200);
}
@lazytomatolab
lazytomatolab / Class_12.ino
Created December 23, 2017 13:55
【Arduino SpeedUp】快速上手 Class 12 - 分類帽 switch case 降臨!更多資訊請造訪:http://www.lazytomatolab.com
void setup() {
Serial.begin(115200);
}
void loop() {
if(Serial.available()) {
int num = Serial.parseInt();
switch(num) {
case 1:
@lazytomatolab
lazytomatolab / Class_11_1.ino
Created September 27, 2017 03:07
【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() {
}
@lazytomatolab
lazytomatolab / Class_10_1.ino
Created August 20, 2017 13:51
【Arduino SpeedUp】快速上手 Class 10 - 互動?遊戲?按鈕特輯 3!更多資訊請造訪:http://www.lazytomatolab.com
boolean state = false;
boolean buttonUp = true;
void setup() {
pinMode(7, INPUT);
pinMode(8, OUTPUT); // INA
digitalWrite(8, LOW);
pinMode(9, OUTPUT); // INB
digitalWrite(9, LOW);
}
@lazytomatolab
lazytomatolab / Class_9.ino
Last active July 2, 2017 12:39
【Arduino SpeedUp】快速上手 Class 9 - 邏輯?旗標?按鈕特輯 2!更多資訊請造訪:http://www.lazytomatolab.com
boolean state = false;
boolean buttonUp = true;
void setup() {
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
pinMode(7, INPUT);
digitalWrite(7, HIGH);
}
@lazytomatolab
lazytomatolab / Class_8_1.ino
Created April 30, 2017 17:09
【Arduino SpeedUp】快速上手 Class 8 - 互動?遊戲?按鈕特輯!更多資訊請造訪:http://www.lazytomatolab.com
void setup() {
pinMode(7, INPUT);
digitalWrite(7, HIGH);
pinMode(13, OUTPUT);
}
void loop() {
if(digitalRead(7) != HIGH){
digitalWrite(13, HIGH);
}
@lazytomatolab
lazytomatolab / Class_7.ino
Created December 29, 2016 16:23
【Arduino SpeedUp】快速上手 Class 7 - 程式宣告?取個綽號吧!更多資訊請造訪:http://www.lazytomatolab.com
int led = 7;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
@lazytomatolab
lazytomatolab / Class_6.ino
Created December 7, 2016 08:31
【Arduino SpeedUp】快速上手 Class 6 - LED 與電阻的必學之術!更多資訊請造訪:http://www.lazytomatolab.com
void setup() {
pinMode(7, OUTPUT);
}
void loop() {
digitalWrite(7, HIGH);
delay(1000);
digitalWrite(7, LOW);
delay(1000);
}
@lazytomatolab
lazytomatolab / Class_5.ino
Created November 6, 2016 12:48
【Arduino SpeedUp】快速上手 Class 5 - 麵包板是什麼?好吃嗎?更多資訊請造訪:http://www.lazytomatolab.com/
void setup() {
pinMode(7, INPUT);
digitalWrite(7, HIGH);
pinMode(13, OUTPUT);
}
void loop() {
if(digitalRead(7) == HIGH){
digitalWrite(13, HIGH);
}