Minor modification in doc and add global variables in sapin_noel.ml

This commit is contained in:
Tobias Bora 2013-12-17 21:23:04 +01:00
parent 1a7b22e8d4
commit 03753f2129
4 changed files with 11 additions and 6 deletions

View File

@ -1,3 +1,4 @@
# This Makefile is really not optimized...
CC=ocamlc CC=ocamlc
OPT=-custom OPT=-custom

View File

@ -5,8 +5,8 @@ and then
: sudo ./sapin_noel.bin : sudo ./sapin_noel.bin
* Goal * Goal
This script uses the wiringPi library http://wiringpi.com/ (thank you for your job) and adapt it in order to make it usable in Ocaml. Must common functions are implemented (see wiringPiOcaml.ml) but lot's a function aren't present for the moment. It's very simple to add these functions, so you can add them and if you want I can add your modifications. This script uses the wiringPi library http://wiringpi.com/ (thank you for your job) and adapts it in order to make it usable in Ocaml. Most common functions are implemented (see wiringPiOcaml.ml) but lot's of functions aren't present for the moment. It's very simple to add these functions, so you can add them and if you want I can add your modifications.
There is too a little script to use shift registers. There is too a little script to use shift registers, and an example file named sapin_noel.ml.
Enjoy ! Enjoy !

Binary file not shown.

View File

@ -1,6 +1,10 @@
open WiringPiOcaml;; open WiringPiOcaml;;
open ShiftReg;; open ShiftReg;;
let g_invert = false
and g_pulse = false
and g_nb_reg = 2
(* Ici on utilise des fonctions plus souples mais moins agréables pour les tests. Pour voir les fonctions classiques, cf anim_01 *) (* 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 = let test reg leds =
lightLeds leds; lightLeds leds;
@ -60,17 +64,17 @@ let anim_02 reg leds n =
done done
let _ = let _ =
let t = true
and f = false in
(* On choisit le mode d'affichage Phys *) (* On choisit le mode d'affichage Phys *)
ignore(setupPhys ()); ignore(setupPhys ());
(* reg : pin_value = p_v, pin_shift = p_s, pin_apply = p_a *) (* reg : pin_value = p_v, pin_shift = p_s, pin_apply = p_a *)
(* On crée le register *) (* On crée le register *)
(* En mode pulse : *) (* En mode pulse : *)
(* let reg = genReg 11 13 15 ~pulse:true in *) (* let reg = genReg 11 13 15 ~pulse:true in *)
let reg = genReg 11 13 15 ~invert:false in let reg = genReg 11 13 15 ~invert:g_invert ~pulse:g_pulse in
(* On initialise *) (* On initialise *)
let leds = initReg reg ~nb_reg:2 in let leds = initReg reg ~nb_reg:g_nb_reg in
let t = true
and f = false in
Printf.printf "Début\n%!"; Printf.printf "Début\n%!";
(* And a pretty animation *) (* And a pretty animation *)
anim_01 reg leds max_int; anim_01 reg leds max_int;