ポイカメラ

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
higedura
Date:
Sun Jan 31 00:54:11 2016 +0000
Commit message:
???????????????

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Jan 31 00:54:11 2016 +0000
@@ -0,0 +1,77 @@
+#include "mbed.h"
+
+DigitalOut led_b(LED1);
+DigitalOut led_g(LED2);
+DigitalOut led_r(LED3);
+DigitalIn button_cam(P0_12);
+DigitalIn button_mov(P0_13);
+DigitalOut fet_ready(P0_0);
+DigitalOut fet_cam(P0_23);
+DigitalOut fet_mov(P0_14);
+
+
+int main(){
+    
+    led_r = 0;
+    led_g = 0;
+    led_b = 1;
+    
+    int flag_ready = 0;
+    int flag_mov = 0;
+    
+    while(1){
+        
+        if(button_cam == 1 || button_mov == 1){
+            led_r = 0;
+            led_g = 1;
+            led_b = 0;
+            fet_ready = 1;
+            wait(0.1);
+            fet_ready = 0;
+            flag_ready = 1;
+            wait(1);
+        }
+        
+        while(flag_ready == 1){
+            if(button_cam == 1){
+                led_r = 1;
+                led_g = 0;
+                led_b = 0;
+                for(int i=0;i<10;i++){
+                    fet_cam = 1;
+                    wait(0.1);
+                    fet_cam = 0;
+                    wait(0.1);
+                }
+                led_r = 0;
+                led_g = 1;
+                led_b = 0;
+                wait(1);
+            }
+            if(button_mov == 1){
+                led_r = 1;
+                led_g = 1;
+                led_b = 1;
+                fet_mov = 1;
+                wait(0.1);
+                fet_mov = 0;
+                flag_mov = 1;
+                wait(1);
+                while(flag_mov == 1){
+                    if(button_mov == 1){
+                        fet_mov = 1;
+                        wait(0.1);
+                        fet_mov = 0;
+                        flag_mov = 0;
+                    }
+                }
+                led_r = 0;
+                led_g = 1;
+                led_b = 0;
+                wait(1);
+            }
+        }
+        
+    }
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Jan 31 00:54:11 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6f327212ef96
\ No newline at end of file