34 lines
750 B
OCaml
34 lines
750 B
OCaml
|
open WiringPiOcaml;;
|
||
|
open ShiftReg;;
|
||
|
|
||
|
let _ =
|
||
|
(* On choisit le mode d'affichage Phys *)
|
||
|
setupPhys ();
|
||
|
(* reg : pin_value = p_v, pin_shift = p_s, pin_apply = p_a *)
|
||
|
(* On crée le register *)
|
||
|
let reg = (11,13,15) in
|
||
|
(* On initialise *)
|
||
|
let leds = initRegister reg ~nb_reg:1 in
|
||
|
(* On boucle pour afficher les leds unes par unes *)
|
||
|
while true do
|
||
|
|
||
|
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;
|
||
|
applyReg reg leds;
|
||
|
delay 100;
|
||
|
leds.(k) <- false
|
||
|
done;
|
||
|
lightLeds leds;
|
||
|
applyReg reg leds;
|
||
|
Unix.sleep 1;
|
||
|
clearLeds leds;
|
||
|
done
|
||
|
|
||
|
;;
|