From d65bed4fa6e0bb8da12c25a1a07e65a222cc9e4e Mon Sep 17 00:00:00 2001 From: Tobias Bora Date: Sat, 7 Dec 2013 22:52:01 +0100 Subject: [PATCH] Pulse mode created. --- sapin_noel.bin | Bin 290911 -> 291979 bytes sapin_noel.ml | 36 +++++++++++++++------ shiftReg.ml | 83 ++++++++++++++++++++++++++++++++++--------------- 3 files changed, 85 insertions(+), 34 deletions(-) diff --git a/sapin_noel.bin b/sapin_noel.bin index 3da8cfb09989ecf1a4ece5e1cf93b5233606a1c1..8d42b4670aaefef95f7587bdc8583c523290ed81 100755 GIT binary patch delta 15779 zcma)j3tU#ky8g`Yea2^Cps3&_A+W$Jc)uYasNf|rDWUL|SXh*_r4twiDi$URwy;6- zf_Vv3OZR6jElMma*qf4ecD9z4m7b%OJ3HClx{v00p0!x{ZFm3Q?>|3Zo_S~9nR#c{ zGnX~%^Q%+AE6)X2h0BaJ5uH7$p-QCIK-MJ9jW2*gaSMb}Atb;~^8@;cj8Gveo)Dr< zYrX>3!@eGQ^=rP~9P;`5ZI8S^@V3IX^=Uo7dOdxxKJx7%Z?(+4MHYC^2hH-68OG$0 z9krGwjO<}*v;Ko=#Rxg6YPuKRslSX4t*Z#86_@ZkM z*ciWdy;Y_g-MdxFLSs+2{!IF^+f2gf?r+Nm@73;y+LlCh_Y)oA-5{b1b)e3Ww}iM5 z<|jJM6yhQ=ONdLvFNL^5d=`y%0X`{&i#S#Yf8rn^0*HTxPsE#q2qCT#B9xdTL^oop z5aGlqQ6i!kStvv_akUVAh@*vwB^JUlVwn)bh$%vhBHk-RA`y61xhKNAw7hPi&9JO1w*mLgGV06can( zsS^hZQAWh0E+>A1$4<-;qKcR(L^bh%5H-YYLTn)3EkrG`WU3I`82MU=IwE+poA{;> zdx;MUv7b0ehy%nh@Q65Ahz8;dLL4D>$D<<#3eik_Oo$fZQX!5JhYN9>I9Z63#AqQ- z0ZTf~65=!y<_U3@SR}*`#Am<(VhlJyTn7#iH-Q7hJaC{Z@HjX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5gIndO#Z=v#8>cU$Xt!P#JHne=z{x%{} zho9e;?^^k_-J;&vkLRmGbzwjH^tc}O4%P?C(PQ6bJf<=aAUWO$4xp>6_1F&P3DUoQ zP`-gDo0;#SSFu>XC%@-1-k0Bd^Orbh!>yS(45;EmJU>zG4?xZWz4!y9!IMnghrr`% z`-d3!G*$c&y0S&t4r8=()!M_T%t>|PFe)9Y!a4!*dPOIC1H*3X!r%qy7rJ1BiidrQ ze6m#Lr}C?yYL~)ax(5qt?@rA_wiSA`$~=Njs#O(7WM`k)hsMmCANzbpx70Jb-F{dk z7n3@bVi`@IDj?M|!j=XiAOoCu<6S)702O!)L zjQq;U_Nfr3ePM6duX!lEx4eo;rO-2Bv>1WVwki3s5G*>PLg9}C$6;r8JlV8k;hco?w1 z>Y8ftS8iDrpRhpaoEaCwL%t2diWzY$(6x55!wTQu{@@d3eTN6BiKP}h?NE88mKSKd`li$pjO=e&WC?Whn)Jt#y1v_P`EkmD mhl_Lc+yXVB%yRpHKSbu-ojDEU4oyqWML~V0t4GQ#f&UNI?Rf_P diff --git a/sapin_noel.ml b/sapin_noel.ml index dcaeace..951f1ca 100644 --- a/sapin_noel.ml +++ b/sapin_noel.ml @@ -3,18 +3,34 @@ open ShiftReg;; let _ = (* On choisit le mode d'affichage Phys *) - setupPhys (); + ignore(setupPhys ()); (* reg : pin_value = p_v, pin_shift = p_s, pin_apply = p_a *) (* On crée le register *) - let reg = genReg 11 13 15 ~invert:true in + let reg = genReg 11 13 15 in (* On initialise *) let leds = initReg reg ~nb_reg:1 in (* On boucle pour afficher les leds unes par unes *) Printf.printf "début\n%!"; - findLedNumber reg leds; - while true do - + (* On remplit le tableau avec true *) + lightLeds leds; + (* Pour montrer la différence entre les deux modes *) + (* The pulse mode... *) + applyRegPulse reg leds 2.; + (* The classic mode... *) + applyReg reg leds; + Unix.sleep 2; + (* Only one led : *) + clearLeds leds; + leds.(1) <- true; + (* Pulse *) + applyRegPulse reg leds 2.; + (* classic *) + applyReg reg leds; + Unix.sleep 2; + (* And a pretty animation *) + for i = 0 to 6 do + clearLeds leds; for k = 0 to (Array.length leds) - 1 do leds.(k) <- true; applyReg reg leds; @@ -23,14 +39,16 @@ let _ = done; for k = (Array.length leds) - 2 downto 0 do leds.(k) <- true; - applyReg reg leds; - delay 100; + applyRegPulse reg leds 0.1; + (* applyReg reg leds; *) + (* delay 100; *) leds.(k) <- false done; lightLeds leds; + (* applyRegPulse reg leds 1.; *) applyReg reg leds; Unix.sleep 1; - clearLeds leds; - done + done; + findLedNumber reg leds; ;; diff --git a/shiftReg.ml b/shiftReg.ml index 2f53c1a..8316254 100644 --- a/shiftReg.ml +++ b/shiftReg.ml @@ -6,10 +6,16 @@ *) open WiringPiOcaml (** reg : (pin_value = p_v, pin_shift = p_s, pin_apply = p_a). It is - used to contain the informations about connections. The invert - variable is used in order to revert the mode (false = lighted, + used to contain the informations about connections. + The invert variable is used in order to revert the mode (false = lighted, true = not lighted) **) -type reg = {p_v : int; p_s : int; p_a : int; invert : bool} +type reg = {p_v : int; p_s : int; p_a : int; invert : bool;} + + +let genReg ?invert:(invert = false) pin_value pin_shift pin_apply = + {p_v = pin_value; p_s = pin_shift; p_a = pin_apply; invert} + +let write pin value = digitalWrite pin (if value then 1 else 0) (** The first thing to do is setupPhys (). This function put in OUTPUT mode the outputs and return back a bool array which represent the output of registers (begining with the first LED of the first shift register) **) @@ -17,44 +23,73 @@ let initReg ?nb_reg:(nb_reg = 1) reg = pinMode reg.p_v 1; (* mode output *) pinMode reg.p_s 1; pinMode reg.p_a 1; + write reg.p_v false; + write reg.p_s false; + write reg.p_a false; Array.make (8*nb_reg) false (* return back an array for all pieces *) -let write pin value = digitalWrite pin (if value then 1 else 0) - -let genReg ?invert:(invert = false) pin_value pin_shift pin_apply = - {p_v = pin_value; p_s = pin_shift; p_a = pin_apply; invert = invert} - -(** This function apply all modifications to the register **) +(* Functions related to basic action of the register *) +let shift reg value = + write reg.p_s false; + write reg.p_v (value <> reg.invert); (* On inverse si besoin *) + write reg.p_s true +let validate reg = + write reg.p_a true; + write reg.p_a false + +(** This function apply all modifications to the register in the same time **) let applyReg reg leds = write reg.p_a false; for i = (Array.length leds) - 1 downto 0 do - write reg.p_s false; - write reg.p_v (leds.(i) <> reg.invert); (* On inverse si besoin *) - write reg.p_s true; + shift reg leds.(i) done; - write reg.p_a true - - + validate reg + +let applyRegPulse reg leds ?d_t:(d_t = 3000) time = + let t = Unix.gettimeofday () in + let first_time = ref true in + (* Clear the leds *) + write reg.p_a false; + for i = (Array.length leds) - 1 downto 0 do + shift reg false + done; + (* It create a one at the very beginning *) + shift reg true; + while !first_time || Unix.gettimeofday () -. t < time do + for i = 0 to (Array.length leds) - 1 do + (* We add a zero (we need only one true on the line *) + if leds.(i) then begin + (* On valide en attendant un petit coup *) + validate reg; + delayMicroseconds d_t; + end; + shift reg false; + done; + first_time := false; + shift reg true; + done + (** Don't forget to apply it with applyReg after **) let clearLeds leds = Array.iteri (fun i x -> (leds.(i) <- false)) leds let lightLeds leds = Array.iteri (fun i x -> (leds.(i) <- true)) leds -(** This function is usefull to find a LED in a logarithm time **) -let makeIntervalArray leds a b = - Printf.printf "%d;%d" a b; - Array.iteri - (fun i x -> leds.(i) <- ((a <= i) && (i < b)) ) - leds - -let printArray t = +let printBoolArray t = for k = 0 to Array.length t - 1 do Printf.printf "%b;" t.(k) done; Printf.printf "\n%!\n" + +(** This function is usefull to find a LED in a logarithm time **) let findLedNumber reg ?time_answer:(time_answer = 3) leds0 = + let makeIntervalArray leds a b = + Printf.printf "%d;%d" a b; + Array.iteri + (fun i x -> leds.(i) <- ((a <= i) && (i < b)) ) + leds + in let n = Array.length leds0 in let leds = Array.make n false in let i = ref 0 in @@ -64,7 +99,6 @@ let findLedNumber reg ?time_answer:(time_answer = 3) leds0 = let middle = !i + (!j - !i)/2 in makeIntervalArray leds !i middle; applyReg reg leds; - printArray leds; Printf.printf "\nLighted ? (1 = Yes, other = no) %!"; let res = input_line stdin in if res = "1" then @@ -77,7 +111,6 @@ let findLedNumber reg ?time_answer:(time_answer = 3) leds0 = Printf.printf "\nI think it's this LED : %d.\n%!" !i; clearLeds leds; leds.(!i) <- true; - printArray leds; applyReg reg leds; Unix.sleep time_answer end