レポート 課題5

Dependencies:   mbed

Fork of test1 by 圭祐 杉浦

Files at this revision

API Documentation at this revision

Comitter:
12f2027a
Date:
Fri May 23 08:12:13 2014 +0000
Parent:
0:6cd606287eb8
Commit message:
a

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 6cd606287eb8 -r dd1f5b571cc2 main.cpp
--- a/main.cpp	Mon May 19 05:16:11 2014 +0000
+++ b/main.cpp	Fri May 23 08:12:13 2014 +0000
@@ -1,37 +1,135 @@
 #include "mbed.h" 
  
-BusOut leds(P1_13, P1_14, P1_22, P0_17, P0_18, P0_19, P1_15, P0_1);
- 
-int main()
+BusOut myleds(P1_13, P1_14, P1_22, P0_17, P0_18, P0_19, P1_15, P0_1);
+
+void tennmetsu1();
+void tennmetsu2();
+void tennmetsu3();
+void tennmetsu4();
+void tennmetsu5();
+void tennmetsu6();
+
+int main( )
 {
- 
+    
     while(1)
     {
-       void roll1();
-       void roll2();
-    
+        
+        tennmetsu1();
+        tennmetsu2();
+        tennmetsu5();
+        tennmetsu6();
+        tennmetsu3();
+        tennmetsu4();
+        tennmetsu1();
+        tennmetsu3();
+        
+        
+        
+        
     }
-       
+}
+
+void tennmetsu1()
+{
+    int i;
+    for( i = 0; i < 2; i++){
+            myleds = 0xff;
+            wait(0.2);
+            myleds = 0x00;
+            wait(0.2);
+        }
+}
+
+void tennmetsu2()
+{
+    int j;
+    volatile uint8_t a;
+    for( j = 0; j < 2; j++){
+        for( a = 0; a < 8; a++){
+             myleds = 256 >> a;
+             wait(0.15);
+        }
+        for( a = 0; a < 8; a++){
+             myleds = 1 << a;
+             wait(0.15);
+        }
+    }
 }
 
 
+void tennmetsu3()
+{
+    myleds = 0xc3;
+    wait(0.2);
+    myleds = 0x3c;
+    wait(0.2);
+    myleds = 0xc3;
+    wait(0.2);
+    myleds = 0x3c;
+    wait(0.2);
+    myleds = 0x81;
+    wait(0.2);
+    myleds = 0x42;
+    wait(0.2);
+    myleds = 0x18;
+    wait(0.2);
+    myleds = 0x24;
+    wait(0.2);
+    myleds = 0x42;
+    wait(0.2);
+    myleds = 0x81;
+    wait(0.2);
+}
 
-void roll1()
+void tennmetsu4()
 {
-    int i;
-    for(i = 0; i < 8; i++)
-    {
-        leds = 1 << i;
-        wait(0.3);
+    myleds = 0x90;
+    wait(0.2);
+    myleds = 0x09;
+    wait(0.2);
+    myleds = 0x99;
+    wait(0.2);
+    myleds = 0x66;
+    wait(0.2);
+    myleds = 0x60;
+    wait(0.2);
+    myleds = 0x06;
+    wait(0.2);
+    
+}
+
+void tennmetsu5()
+{
+    myleds = 0xa2;
+    wait(0.2);
+    myleds = 0x2e;
+    wait(0.2);
+    myleds = 0xec;
+    wait(0.2);
+    myleds = 0xb9;
+    wait(0.2);
+    myleds = 0x6d;
+    wait(0.2);
+    myleds = 0x11;
+    wait(0.2);
+}
+
+void tennmetsu6()
+{
+    int j;
+    int k;
+    volatile uint8_t a;
+    for( j = 0; j < 3; j++){
+        for( a = 0; a < 8; a++){
+             myleds = 256 >> a;
+             wait(0.05);
+        }
+    }
+    for( k = 0; k < 3; k++){
+        for( a = 0; a < 8; a++){
+             myleds = 1 << a;
+             wait(0.05);
+        }
     }
 }
-    
-void roll2()
-{
-    int j;
-    for(j = 0; j < 8; jj=^^+2)
-    {
-        leds = 192 >> j;
-        wait(0.1);
-    }
-}
\ No newline at end of file