Browse Source

上传文件至 ''

Yadong Zhang 6 years ago
parent
commit
93f73bb5ed
3 changed files with 54 additions and 0 deletions
  1. 17 0
      for.ino
  2. 16 0
      if_else.ino
  3. 21 0
      while.ino

+ 17 - 0
for.ino

@@ -0,0 +1,17 @@
+void setup() {
+  Serial.begin(9600);
+  }
+
+void loop() 
+{ 
+  Serial.println("Countdown:");
+  int i;
+  for (i=10;i>=0;i--){    
+    Serial.println(i);
+         if (i<=0){
+            Serial.println("Happy new years");
+            break;} 
+            delay(1000); }
+   
+            }
+  

+ 16 - 0
if_else.ino

@@ -0,0 +1,16 @@
+
+void setup() {
+  Serial.begin(9600);}
+
+int i=10;
+void loop() 
+{ 
+    if (i>0){
+      Serial.println("Countdown:");
+      Serial.println(i);
+    i--;}
+    else{
+      Serial.println("Happy new years");}
+           
+      delay(1000);}
+            

+ 21 - 0
while.ino

@@ -0,0 +1,21 @@
+int i =10;
+
+void setup() {
+  Serial.begin(9600);
+  while (i>=0){
+    Serial.println("countdown:");
+    Serial.println(i);
+    i--;
+    delay(1000);
+  if (i<0){
+    Serial.println("Happy news Years");
+    break;}
+  }
+  
+  }
+
+
+void loop() 
+{ 
+  
+            }