From 076fc5854570045ce8da20cf22d2d295e315edff Mon Sep 17 00:00:00 2001 From: Tobias Bora Date: Sun, 8 Dec 2013 00:18:56 +0100 Subject: [PATCH] The pulse mode is written in reg now. --- sapin_noel.bin | Bin 291979 -> 292316 bytes sapin_noel.ml | 84 +++++++++++++++++++++++++------------------------ shiftReg.ml | 35 +++++++++++++-------- 3 files changed, 65 insertions(+), 54 deletions(-) diff --git a/sapin_noel.bin b/sapin_noel.bin index 8d42b4670aaefef95f7587bdc8583c523290ed81..89b53b7f5104b0287199b0d7b3874f8938a2f91c 100755 GIT binary patch delta 15621 zcma)j4O~^ly8g`Uy^XD4;3pgW*aRLSQBY7JKt5Fn4OA*jOiV~9N<7jH4BMDkkQ(Sh z2lI>aBTP(e>seB!SXR=Z#FO2lWu>L}sOd@nhtAQi=6&9^Sh@0afA_zBzn5p;nRjO1 znR#Z`%&g6_3qGfQ@Tqn3$dv*8?cu(Hh1Ww?CeDe=fkI+qcq$m<06oqEw6ICOj8#6% zShucp0o(%nElAt4^30|_7Oy2U4{UjDu(OB%!l9Sg#Z~L#ue$4a_T4l zgJGlm;y;LoD+34A@N8x0fG~>sX27Ea;|3n!4epx*4|aEX4z#eo@NNL16=k5zKJPJh z!eL?k9%bwl;dI7M6Mn3E_AsVLM~tghLpM zBz%#vD8l;~izR%Eu>``|jHM8M!B{F`or|$a6xhjFCZRuLS%h}RvI%=(SP7>xmP_~q zV|j$V87m-+V62D`LtRYxIb$V+S&WquCNNe`xDPBL+yYt@GPa&@5@QX74)BO@G=_?B9b-*|0~u>3^kQre;e5vS5x&6Ke!^(RS_vmJ zc9<}ju_HiNzgdj6Q$#*v9fW0!9VdJV93Tt<2ME`K1B4sF0m341fbax3KaoNP{g0W0m6I10m2>N z0O2NZfbb)5fbbJ=fG`OhAbcAfAY29x5Do$d2=5062s6L|!k*v&;VN)|umK!!QJ@hV zAp8IvAbbWKAY2R%5N3h{gw@~xVH7w(m<y)iS=C9{ z7aSn$0S*w}0}c!ThJgcw2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F>rH?Rxjl9@#rvy`5(Z84%LGcToGd%J{JC z4{D!!HXj;~0f)GIk&PQT9EnvGi)?O~&xX{Tt^XB9~I(u$BiCwL& zah#H$J$-h;ynLk8=^4-1s-)NYGxfd;Y9HD6(qFxvm^RD)w7QjVEAkpzvH5{Df7N1c oTwWai>E6iYs_a=?uTFhE(jHBoh)p*(F+M#WeVMNsp0x%3U-@3OMgRZ+ diff --git a/sapin_noel.ml b/sapin_noel.ml index 951f1ca..8d3f578 100644 --- a/sapin_noel.ml +++ b/sapin_noel.ml @@ -1,54 +1,56 @@ open WiringPiOcaml;; open ShiftReg;; +(* Ici on utilise des fonctions plus souples mais moins agréables pour les tests. Pour voir les fonctions classiques, cf anim_01 *) +let test reg leds = + lightLeds leds; + (* Pour montrer la différence entre les deux modes *) + Printf.printf "The pulse mode...\n%!"; + applyRegPulse reg leds 2.; + + Printf.printf "The classic mode...\n%!"; + applyRegAll reg leds; + Unix.sleep 2; + + Printf.printf "Only one led :\n%!"; + clearLeds leds; + leds.(1) <- true; + Printf.printf "The pulse mode...\n%!"; + applyRegPulse reg leds 2.; + + Printf.printf "The classic mode...\n%!"; + applyRegAll reg leds; + Unix.sleep 2 + +(* S'inspirer de ce schéma pour les animations *) +let anim_01 reg leds n = + for i = 0 to n do + clearLeds leds; + for k = 0 to (Array.length leds) - 1 do + leds.(k) <- true; + applyReg reg leds 0.1; + leds.(k) <- false + done; + for k = (Array.length leds) - 2 downto 0 do + leds.(k) <- true; + applyReg reg leds 0.1; + leds.(k) <- false + done; + lightLeds leds; + applyReg reg leds 1.; + done + let _ = (* On choisit le mode d'affichage Phys *) ignore(setupPhys ()); (* reg : pin_value = p_v, pin_shift = p_s, pin_apply = p_a *) (* On crée le register *) + (* En mode pulse : let reg = genReg 11 13 15 ~pulse: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%!"; - (* 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; + Printf.printf "Début\n%!"; (* 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; - delay 100; - leds.(k) <- false - done; - for k = (Array.length leds) - 2 downto 0 do - leds.(k) <- true; - 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; - done; - findLedNumber reg leds; - -;; + anim_01 reg leds max_int; + (* findLedNumber reg leds *) diff --git a/shiftReg.ml b/shiftReg.ml index 8316254..761088d 100644 --- a/shiftReg.ml +++ b/shiftReg.ml @@ -8,12 +8,12 @@ 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, - true = not lighted) **) -type reg = {p_v : int; p_s : int; p_a : int; invert : bool;} + true = not lighted). The pulse function is only used with applyReg **) +type reg = {p_v : int; p_s : int; p_a : int; pulse : bool; 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 genReg ?pulse:(pulse = false) ?invert:(invert = false) pin_value pin_shift pin_apply = + {p_v = pin_value; p_s = pin_shift; p_a = pin_apply; pulse; invert} let write pin value = digitalWrite pin (if value then 1 else 0) @@ -28,7 +28,7 @@ let initReg ?nb_reg:(nb_reg = 1) reg = write reg.p_a false; Array.make (8*nb_reg) false (* return back an array for all pieces *) -(* Functions related to basic action of 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 *) @@ -36,15 +36,16 @@ let shift reg value = 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 = +let applyRegAll reg leds = write reg.p_a false; for i = (Array.length leds) - 1 downto 0 do shift reg leds.(i) done; validate reg +(** This function opens and closes very quickly each LED, one after the other**) let applyRegPulse reg leds ?d_t:(d_t = 3000) time = let t = Unix.gettimeofday () in let first_time = ref true in @@ -61,7 +62,7 @@ let applyRegPulse reg leds ?d_t:(d_t = 3000) time = if leds.(i) then begin (* On valide en attendant un petit coup *) validate reg; - delayMicroseconds d_t; + (* delayMicroseconds d_t; *) end; shift reg false; done; @@ -69,6 +70,16 @@ let applyRegPulse reg leds ?d_t:(d_t = 3000) time = shift reg true; done +(** Generic function which choose the good mode (Pulse or not) and wait. + (time in seconds, float) **) +let applyReg reg leds time = + if reg.pulse then + applyRegPulse reg leds time + else begin + applyRegAll reg leds; + delay (int_of_float (time *. 1000.)) + end + (** Don't forget to apply it with applyReg after **) let clearLeds leds = Array.iteri (fun i x -> (leds.(i) <- false)) leds @@ -79,7 +90,7 @@ let printBoolArray t = for k = 0 to Array.length t - 1 do Printf.printf "%b;" t.(k) done; - Printf.printf "\n%!\n" + Printf.printf "\n%!" (** This function is usefull to find a LED in a logarithm time **) @@ -95,23 +106,21 @@ let findLedNumber reg ?time_answer:(time_answer = 3) leds0 = let i = ref 0 in let j = ref n in while !i < (!j - 1) do - Printf.printf "%d;%d" !i !j; let middle = !i + (!j - !i)/2 in makeIntervalArray leds !i middle; - applyReg reg leds; + applyRegAll reg leds; Printf.printf "\nLighted ? (1 = Yes, other = no) %!"; let res = input_line stdin in if res = "1" then j := middle else i := middle; - Printf.printf "%d;%d" !i !j; done; if time_answer > 0 then begin Printf.printf "\nI think it's this LED : %d.\n%!" !i; clearLeds leds; leds.(!i) <- true; - applyReg reg leds; + applyRegAll reg leds; Unix.sleep time_answer end