samedi 30 novembre 2013

Bibliothèque de travailler avec mayhewlabs Mux Shield et Arduino.

http://code.google.com/p/muxshield/downloads/detail?name=MuxShield.zip&can=2&q=

MuxShield.zip - muxshield - MuxShield 0.1 - Arduino Mux Shield - Google Project Hosting 

jeudi 28 novembre 2013

Gestion des entrées sorties  numérique  MuxShield

#include <MuxShield.h>
Mux mux = Mux();
int i;
boolean ent_num[16];
//*******************************************
void setup(){
  mux.control();
  Serial.begin(115200);
}
//*******************************************
void loop(){
  lecture_entree();
  ecriture_sortie();

}
//*******************************************
void lecture_entree(){
     for (i=0; i <= 5;  i++) {
         mux.io("DI", 0, i, 1);
         ent_num[i]=!mux.lecturadigital(0);
         mux.io("DI", 0, i, 0);
     }
}
//*******************************************
 void ecriture_sortie(){
   for (i=0; i <= 5;  i++) {
        if (ent_num[i]==1){mux.io("DO", 1, i, 1);
           delay(1);
            mux.io("DO", 1, i, 0);
        }
   }
}
//*******************************************

mercredi 27 novembre 2013


Mux Shield    Mayhew Labs



vous avez besoin de beaucoup d'entrées et / ou sorties, ceci est votre solution! Le multiplexeur (multiplexeur) Bouclier ajoute la capacité de jusqu'à 48 entrées ou sorties sur l'Arduino Mega et Arduino. En utilisant trois Texas Instruments CD74HC4067 multiplexeurs analogiques, le Bouclier Mux permet d'avoir 48 entrées analogiques / numériques ou sorties numériques dans de nombreuses combinaisons. Le Bouclier Mux est livré avec têtes 5V et au sol de sorte que vous aurez la puissance disponible à chaque entrée ou sortie et est livré avec des embases empilables installés. Le code source ci-dessous vous permettra d'utiliser!
 

Caractéristiques:

48 entrées analogiques / entrées / sorties numériques (en combinaison)
Vcc et tête au sol (bandes chaque broche d'entrée / sortie a une Vcc dédié et sol)
• Bouton de réinitialisation
PIN 13 LED et LED de puissance
têtes empilables (se branchent directement sur Arduino et ajouter d'autres écrans sur le dessus)
Arduino Mega compatible
Nécessite broches numériques 2,3,4,5 et broches analogiques 0,1,2 - 48 entrées / sorties pour le prix de 7 broches


http://mayhewlabs.com/products/arduino-mux-shield
 Google Traduction




 //  mux_out_inp_ana_.mux
// 27-11-2013


// Pour afficher l'exemple suivant:
//nous connectons 3 diodes LED
// On sorties 0, 1, 2 de la MUX0 (place des résistances appropriées).
//  nous connectons 3 interrupteurs
// Entrées 0, 1, 2 de la MUX1
// nous connectons les centres de trois potentiomètres
//sur les entrées de la MUX2 0,1,2


// Google Traduction

// Nous incluons la bibliothèque pour travailler avec elle

#include <MuxShield.h>

Mux mux = Mux(); // Nous avons commencé l'objet de multiplexage à utiliser

void setup(){
  mux.control(); // Ceci est chargé d'établir les lignes de commande du MUX pour leur utilisation.
Serial.begin(115200);
}

void loop(){
  mux.io("DO", 0, 0, 1);
  delay(1000);
  mux.io("DO", 0, 0, 0);

 mux.io("DI", 1, 0, 1);
  Serial.print("Lectura de entrada 0 de MUX1: ");
  Serial.println(mux.lecturadigital(1));
 delay(1000);
  mux.io("DI", 1, 0, 0);

 Serial.println(mux.lecturaanalogica(2, 0));
    delay(1000);
 
  mux.io("DO", 0, 1, 1);
  delay(1000);
  mux.io("DO", 0, 1, 0);
 mux.io("DI", 1, 1, 1);
  Serial.print("Lectura de entrada 1 de MUX1: ");
  Serial.println(mux.lecturadigital(1));
  delay(1000);
  mux.io("DI", 1, 1, 0);


   Serial.println(mux.lecturaanalogica(2, 1));
    delay(1000);
 
  mux.io("DO", 0, 2, 1);
  delay(1000);
  mux.io("DO", 0, 2, 0);
 mux.io("DI", 1, 2, 1);
  Serial.print("Lectura de entrada 2 de MUX1: ");
  Serial.println(mux.lecturadigital(1));
  Serial.println("");
  delay(1000);
  mux.io("DI", 1, 2, 0);
  delay(1000);

  Serial.println(mux.lecturaanalogica(2, 2));
    delay(1000);

// Pour travailler avec la syntaxe d'E / S est: OBJETO.io (String FunSignal,
// Int LineSignal, ActivePin int, int Activer)
// Dans ce cas c'est la sortie numérique, la syntaxe est: mux.io (
// "DO" (<- Pour la sortie numérique)
// 0 (<- Indique le MUX à utiliser, dans ce cas, la plaque MUX0),
// 0 (<- Définit la sortie MUX dans ce cas est 0),
// 1 (<- Indique s'il faut activer (1) ou désactiver Nous (0)
//);


// Pour travailler avec la syntaxe de l'entrée analogique est:
// OBJETO.lecturaanalogica (LineSignal int, int ActivePin)
// Dans ce cas, la syntaxe est: mux.lecturaanalogica (
// 2(<- Indique le MUX à utiliser, dans ce cas, la plaque MUX2),
// 0 (<- Indique l'entrée de MUX, dans ce cas est 0),
//);

  
// Pour travailler avec la syntaxe d'E / S est: OBJETO.io (FunSignal String, int LineSignal, ActivePin int, int Activer)
// Dans ce cas, il est entrée numérique, la syntaxe est: mux.io (
// "DI" (<- Pour l'entrée numérique)
// 1 (<- Indique le MUX à utiliser, dans ce cas, la plaque MUX1),
// 0 (<- Indique l'entrée de MUX, dans ce cas est 0),
// 1 (<- Indique s'il faut activer (1) ou désactiver Nous (0)
//);

}





mercredi 6 novembre 2013

' Simulation _ Recherche _ de _ personnes _Panoramic.bas
' 20131101

error_french
label clavier
label sp_rouge,sp_vert,sp_jaune,sp_bleu,envoyer,sp_fin
dim i,nobj,r%,v%,j%,b%,dat$,com_ok,data$,res
dim num,aff$,tch%,lt_cav ,c21%
com_ok=0
nobj=10:giro(nobj,0,80,300,"colonne")
num =100 :lt_cav=80
clavier_hexa(num,120,lt_cav)
affichtxt(200,0,10,50,14,"Simulation Recherche de personnes en Panoramic")
affichtxt(220,0,220,410,14,date$)
nobj=550:voyant(nobj,0,100,440,"Com.Série",0)

nobj=750:button_con(nobj,0,350,460,"F I N")
com_serie()
on_click 751,sp_fin
on_close 0,sp_fin
' ======================
end
' ======================
sp_rouge:
select r%
case 1 :color 12,255,0,0
case 0 :color 12,200,125,125
end_select
return
' =======
sp_vert:
select v%
case 1 :color 14,0,255,0
case 0 :color 14,125,200,125
end_select
return
' =======
sp_jaune:
select j%
case 1 :color 16,255,255,0
case 0 :color 16,200,200,125
end_select
return
' =======
sp_bleu:
select b%
case 1 :color 18,0,255,255
case 0 :color 18,125,200,200
end_select
return
' =======
envoyer:
if com_ok =0 then return
if tch% >=0 and tch% <16
data$=str$(tch%)
if data$="" then return
for i= 1 to len(data$)
c21%=asc(mid$(data$,i,1))
res=dll_call1("ComSetDataOut",c21%)
next i
pause 2
end_if

return
' =====FIN========
sp_fin:
dll_off:pause 4
terminate
return
' =================
clavier:
tch%=0
for i=1 to 16
if clicked(i+num)=1 then tch%=i-1:gosub envoyer
next i
if tch% >7
r%=1 :tch%=tch%-8
else
r%=0
end_if
gosub sp_rouge
if tch% >3
v%=1 :tch%=tch%-4
else
v%=0
end_if
gosub sp_vert
if tch% >1
j%=1 :tch%=tch%-2
else
j%=0
end_if
gosub sp_jaune
if tch% =1
b%=1
else
b%=0
end_if
gosub sp_bleu

return
' ======================
rem =========sub===================
sub clavier_hexa(num,tp,lt)
dim_local i,j,ii
container num+20:top num+20,tp:left num+20,lt
caption num+20,"clavier_numérique"
height num+20,200: color num+20,200,200,50
for i=1 to 16
ii=ii+1:if ii=5 then j=j+1:ii=1
button i+num:width i+num,21:parent i+num,num+20
top i+num,(j*30)+30: left i+num,(ii*30)+5
caption i+num,hex$(i-1)
on_click i+num,clavier
next i
end_sub
rem =================================
sub giro(nos,par,t_c,l_c,txt$)
container nos:parent nos,par:top nos,t_c:left nos,l_c
width nos,80: height nos,250
if len(txt$) > 9 then txt$=left$(txt$,9)
caption nos,txt$
dim_local top_loc,left_loc: top_loc=28: left_loc =30
alpha nos+1:parent nos+1,nos:top nos+1,top_loc:left nos+1,left_loc
width nos+1,24: height nos+1,12:color nos+1,0,0,0 :top_loc=top_loc+12
alpha nos+2:parent nos+2,nos:top nos+2,top_loc:left nos+2,left_loc
width nos+2,24: height nos+2,24:color nos+2,200,125,125:top_loc=top_loc+24
alpha nos+3:parent nos+3,nos:top nos+3,top_loc:left nos+3,left_loc
width nos+3,24: height nos+3,5:color nos+3,0,0,0:top_loc=top_loc+5
alpha nos+4:parent nos+4,nos:top nos+4,top_loc:left nos+4,left_loc
width nos+4,24: height nos+4,24:color nos+4,125,200,125:top_loc=top_loc+24
alpha nos+5:parent nos+5,nos:top nos+5,top_loc:left nos+5,left_loc
width nos+5,24: height nos+5,5:color nos+5,0,0,0:top_loc=top_loc+5
alpha nos+6:parent nos+6,nos:top nos+6,top_loc:left nos+6,left_loc
width nos+6,24: height nos+6,24:color nos+6,200,200,125:top_loc=top_loc+24
alpha nos+7:parent nos+7,nos:top nos+7,top_loc:left nos+7,left_loc
width nos+7,24: height nos+7,5:color nos+7,0,0,0:top_loc=top_loc+5
alpha nos+8:parent nos+8,nos:top nos+8,top_loc:left nos+8,left_loc
width nos+8,24: height nos+8,24:color nos+8,125,200,200:top_loc=top_loc+24
alpha nos+9:parent nos+9,nos:top nos+9,top_loc:left nos+9,left_loc
width nos+9,24: height nos+9,30:color nos+9,0,0,0:top_loc=top_loc+30
alpha nos+10:parent nos+10,nos:top nos+10,top_loc:left nos+10,left_loc+6
width nos+10,12: height nos+10,50:color nos+10,0,0,0:top_loc=top_loc+50
alpha nos+11:parent nos+11,nos:top nos+11,top_loc:left nos+11,left_loc
width nos+11,24: height nos+11,12:color nos+11,0,0,0 :top_loc=top_loc+12
end_sub
rem ===================================
sub button_container(nos,par,t_c,l_c,txtt$)
container nos:parent nos,par:top nos,t_c:left nos, l_c
caption nos ,txtt$
button nos+1:parent nos+1,nos:top nos+1,30:left nos+1,10
width nos+1,30
width nos,width(nos+1)+20
height nos,height(nos+1)+40
end_sub

rem =================================
sub com_serie()
dim_local rc,rrc
rem DLL chargée en mémoire
' suivant configuration
dll_on "F:\Mes_Document_F\Basic_panoramic\Arduino_Panoramic\IO_Acces_COM.dll"
rc= dll_call1("ComUsePort",8)
rrc= dll_call4("ComConfig",115200,8,1,0)
if rc=1 and rrc=1
com_ok =1:position 552,1
else
message "Defaut_com_Serie"
end_if
end_sub
rem =================================
sub affichtxt(nxt,par,tpt,ltt,fsize,txt$)
container nxt:parent nxt,par :top nxt,tpt:left nxt,ltt
Alpha nxt+1:parent nxt+1,nxt:top nxt+1,20:left nxt+1,10
font_bold nxt+1:font_size nxt+1,fsize:caption nxt+1,txt$
width nxt,width(nxt+1)+40
height nxt,height(nxt+1)+40
end_sub
rem =========================
sub voyant(ntp,par,ttp,ltp,txt$,etat)
dim_local top_loc,left_loc: top_loc=28: left_loc =7
container ntp:parent ntp,par:top ntp,ttp:left ntp,ltp
width ntp,80: height ntp,85
if len(txt$) > 9 then txt$=left$(txt$,9)
caption ntp,txt$
alpha ntp+1:parent ntp+1,ntp:top ntp+1,top_loc:left ntp+1,left_loc
width ntp+1,64: height ntp+1,44:color ntp+1,0,0,0
progress_bar ntp+2:parent ntp+2,ntp:top ntp+2,top_loc+4:left ntp+2,left_loc+4
width ntp+2,56: height ntp+2,36:min ntp+2,0:max ntp+2,1
if etat=0
position ntp+2,0
else
position ntp+2,1
end_if
end_sub
rem =========================
sub button_con(nbc,parc,tpc,ltc,txt$)
container nbc:parent nbc,parc:top nbc,tpc:left nbc,ltc
caption nbc ,txt$
button nbc+1:parent nbc+1,nbc:top nbc+1,30:left nbc+1,10
width nbc+1,30
width nbc,width(nbc+1)+20
height nbc,height(nbc+1)+40
end_sub
rem =========================




Code Arduino uno:


int tch = 0;
int buf;
int ascii;
int valeur;
int valeurm;
String chiffre;
// =================
void setup() {
 //code
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
Serial.begin(115200);
}
// ================
void loop() {
buf = Serial.available();
delay(10);
if (buf>0){
  module_reception();
  delay(10);
  tch=valeur;
 if ( valeur|= valeurm){
    valeurm=valeur;
   sp_led();
 } //fin if valeur
 }// fin if buf
}// fin loop
// ================
void sp_led(){
if (tch >7){digitalWrite(5, HIGH);
 tch=tch-8;}
 else {digitalWrite(5, LOW);}

 if (tch >3){digitalWrite(4, HIGH);
 tch=tch-4;}
 else {digitalWrite(4, LOW);}

 if (tch >1){digitalWrite(3, HIGH);
 tch=tch-2;}
 else {digitalWrite(3, LOW);}

 if (tch==1){digitalWrite(2, HIGH);}
 else{digitalWrite(2, LOW);}
 }//fin sp_led
// ===========================
void module_reception(){
while(Serial.available()){
ascii=Serial.read();
if (ascii != -1 ){
if (ascii >47 && ascii< 58){ 
chiffre =chiffre+char(ascii);}
} //fin if -1
} //fin while
valeur=chiffre.toInt();
chiffre="";
buf=0;
}//fin module_reception












lundi 4 novembre 2013

pensée du jour
Panoramic est le monde extérieur.
via une interface électronique programmable USB série virtuelle
Je n'ai rien contre le port parallèle. Mais ne nous voilons pas la face.
 Depuis combien de temps on ne trouve plus d'imprimante parallèle
et encore plus pour les imprimantes série
avec lesquelles nous imprimons les programmes des automates tsx 60.
Les portables et les tablettes on banni les ports parallèles et série de leurs configurations
 reste encore les PC de bureau et pour combien de temps ? .
que reste-t-il a Panoramic pour dialoguer avec le monde extérieur ?.
USB port série virtuel ou Ethernet.il est loin le temps des interfaces figées
elle sont toutes programmables pour s'adapter exemple: APN TV etc.
il est vrai que cela  s'adresse plus
 aux amateurs d'électronique domotique automatisme
espérons que cette nouvelle facette de Panoramic nous attirera de nouveaux membres  sur ce forum 
en attend un éditeur en Panoramic pour programmer directement ces interfaces.

 je vous propose une appli en Panoramic pour dégrossir le programme de ces interfaces.
 donc l'éditeur n'est pas confortable.
 l'appli se compose d'une liste avec les instructions d'un memo et de quelques boutons.
on sélectionne une instruction dans la liste puis on clique  pour coller
l'on adapte l'instruction à son programme
une fois le programme fini on sélectionne tout on fait copier
on appuit sur le bouton "-+"  Ide de l'interface apparaît coller le programme dans cet ide
pour contrôler debugger et transférer vers l'interface.
vous avez la possibilité de chargér et sauvegarder le programme

ps dans le programme Panoramic adaptez le chemin du fichier ide de l'interface et du site web









Code
' editeur_panoramic_pour_langage_exotique.bas
'   20131028
' le site www.mon-club-elec.fr
' http://www.mon-club-elec.fr/pmwiki_reference_arduino/pmwiki.php?n=Main.Serial
 error_french
 width 0,1200:height 0,1000: color 0,50,120,60:caption 0,"Editeur Panoramic pour langage exotique"
 top 0,(screen_y-height(0))/2 :left 0,(screen_x-width(0))/2
 label sp_20,sp_Save,sp_Open,sp_FIN,langage_arduino_1
 label web_club_elec ,sp_cls,uno,translate,sp_9
 dim m ,i ,j,l,acold,acolf,a$,car$ ,f$
 memo 10:top 10,40:left 10,200:width 10,950:height 10,900
   bar_both 10:font_size 10,14: color 10,220,220,220
   font_name 10,"DejaVu Sans Mono"
 list 20:top 20,40:left 20,20:gosub langage_arduino_1
   width 20,170:height 20, 800
 button 1 :top 1,8 :left 1,800 :width 1,27
   font_name 1,"webdings":font_size 1,15:hint 1,"cls" : caption 1,"q"
 button 2 :top 2,8 :left 2,900 :width 2,27
   font_name 2,"wingdings":font_size 2,15:hint 2,"Save":caption 2,"<"
 button 3 :top 3,8 :left 3,600 :width 3,27
   font_name 3,"wingdings":font_size 3,15:hint 3,"Open" :caption 3,"1"
 button 4 : top 4,8: left 4,1100 :width 4,40
   font_name 4,"webdings":font_size 4,15:hint 4,"FIN" :caption 4,"r"
 button 6:top 6,8 :left 6,400 :caption 6,"help" :width 6,27
   font_name 6,"webdings":font_size 6,15:hint 6,"Help":caption 6,"i"
 button 7:top 7,8 :left 7,500 :width 7,50:font_name 7,"SWGamekeys MT"
   font_size 7,15:hint 7,"Arduino":caption 7,"Þ¯"
button 8:top 8,8 :left 8,300 :width 8,27:font_name 8,"webdings"
   font_size 8,15:hint 8,"traduction":caption 8,"ü"
button 9 :top 9,8:left 9,700:caption 9,"{ }":hint 9,"accolade"::width 9,27

 open_dialog 14:save_dialog 15:dir_dialog 14,dir_current$:dir_dialog 15,dir_current$
 on_click 1,sp_cls:on_click 2,sp_Save:on_click 3,sp_Open
 on_click 4,sp_FIN:on_click 6, web_club_elec
 on_click 7,uno:on_click 8,translate
 on_close 0,sp_save :on_click 9,sp_9
 on_click 20 ,sp_20
'  =======================
 end
'  =======================
sp_9:
acold=0:acolf=0
for i=1 to count(10)
a$=item_read$(10,i)
l=len(a$)
for j=1 to l
car$=mid$(a$,j,1)
if car$ ="{" then acold=acold+1
if car$ ="}" then acolf=acolf+1
next j
next i
IF  acold=acolf
message "OK ! { = "+str$(acold)+" - } = "+ str$(acolf)
else
message "DEFAUT ! { = "+str$(acold)+" - } = "+ str$(acolf)
end_if
return
'  =======================
 uno:
  m=message_confirmation_yes_no(" UNO ")
    if m<>1 then return
execute "F:\portable\arduino-1.5.2-windows\arduino-1.5.2\arduino.exe"
return
'  =======================
 sp_Save:
 m=message_confirmation_yes_no(" S A V E ")
 if  m = 1
     file_save 10,file_name$(15)
 end_if
 return
'  =======================
 sp_Open:
  m=message_confirmation_yes_no(" L O A D ")
    if m<>1 then return
 f$=file_name$(14):pause 2
 if f$<>"_" then file_load 10,f$
 return
'  =======================
 sp_FIN:
 m=message_confirmation_yes_no(" Quitter ")
    if m<>1 then return
    gosub sp_save
 terminate
 return
'  =======================
sp_cls:
 m=message_confirmation_yes_no(" Clear Memo ")
    if m<>1 then return
    clear 10
return
'  =======================
sp_20:
 clipboard_string_copy  item_read$(20,item_index(20))+chr$(13)+chr$(10)
return
'  =======================
 langage_arduino_1:
 item_add 20,"/* début rem multiligne"
 item_add 20,"fin rem multilignes */"
 item_add 20,"#include <librairie >"
 item_add 20,"#define constantnom val"
 item_add 20,"int var = val;"
 item_add 20,"boolean var=false; // ou true"
 item_add 20,"char monChar='B';"
 item_add 20,"long var = valeur;"
 item_add 20,"float var = valeur;// 10,5 (nombres à virgules)"
 item_add 20,"char Str[15];"
 item_add 20,"String lettre;"
 item_add 20,"// ===rem_1_ligne======="
 item_add 20,"void setup() { //code }"
 item_add 20,"pinMode(N°Pin,OUTPUT);"
 item_add 20,"pinMode(N°Pin,INPUT);"
 item_add 20,"// ================"
 item_add 20,"void loop() { //code }"
 item_add 20,"digitalWrite(N°Pin, HIGH);"
 item_add 20,"digitalWrite(N°Pin, LOW);"
 item_add 20," val = digitalRead(N°Pin);"
 item_add 20,"val = analogRead(analogPin);"
 item_add 20,"analogWrite(N°Pin, val);"
 item_add 20,"for (i=0; i <= 255;  i++) {//instruction(s)à exécuter;}"
 item_add 20,"if (Variable > 50){ //action }"
 item_add 20,"if (x == y ){ //action }//(x est égal à y)"
 item_add 20,"if (x != y ){ //action }//(x est différent de y)"
 item_add 20,"if (x < y ){ //action }//(x est inférieur à y)"
 item_add 20,"if (x > y){ //action }// (x est supérieur à y)"
 item_add 20,"if (x <= y){ //action }// (x est inférieur ou égal à y)"
 item_add 20,"if (x >= y){ //action }// (x est supérieur ou égal à y)"
 item_add 20,"if (x == y ){ //action a }"
 item_add 20," else  { //action b }"
 item_add 20,"switch (var) { // début de la structure"
 item_add 20,"case 1: // cas 1"
 item_add 20,"break;"
 item_add 20," default: // cas par défaut"
 item_add 20,"} // fins witch"
 item_add 20,"while(Serial.available()){ //code }"
 item_add 20," delay (ms);"
 item_add 20,"mon_sous_programme();"
 item_add 20,"void mon_sous_programme(){ //code }"
 item_add 20,"var=min(x, y);"
 item_add 20,"var=max(x, y);"
 item_add 20,"var=abs(x);"
 item_add 20,"var=constrain(x, a, b),"
 item_add 20,"var=sq(x);"
 item_add 20,"var=sqrt(x);"
 item_add 20,"var=sin(rad);"
 item_add 20,"var=cos(rad);"
 item_add 20,"var=tan(rad);"
 item_add 20,"valeur=chiffre.toInt();"
 item_add 20,"Serial.begin(int vitesse);"
 item_add 20,"Serial.available();"
 item_add 20,"Serial.read();"
 item_add 20,"Serial.print(données);"
 item_add 20,"Serial.println(data);"

return
'  =======================
 web_club_elec:
if message_information_yes_no("Le site web mon-club-elec ?")<>1 then return
execute "firefox.exe http://www.mon-club-elec.fr/pmwiki_reference_arduino/pmwiki.php?n=Main.Reference"
return
'  =======================
translate:
if message_information_yes_no("translate.google ?")<>1 then return
execute "firefox.exe http://translate.google.fr/#en/fr/"
return




Soyons fou un petit délire avec Panoramic  pour faire "mumuse" avec un vérin

 



Code:


 '   20131022

  error_french
 width 0,1000:height 0,800
 top 0,(screen_y-height(0))/2 :left 0,(screen_x-width(0))/2
 label sp_fin,verinAV,verinAR,capteur,auto,manu,vav,var,raz,help1,help0
 dim nobj,i,a,c,compt$
nobj=10 :affichtxt(nobj,20,150,18,"Simulation supervision en Panoramic")
nobj=20: voyant(nobj,100,100,"AUTO","V")
nobj=30 :voyant(nobj,100,350,"NANU","O")
nobj=40: voyant(nobj,100,600,"Verin_1 -- ","O")
nobj=50: voyant(nobj,100,750,"Verin_1 ++ ","O")
nobj=60: verin(nobj,300,600,"Vérin 1")
nobj=70: flip_flop(nobj,300,100,"Auto/Manu")
nobj=80: Bpvert(nobj,300,430,"V plus")
nobj=90: Bpvert(nobj,300,270,"V moin")
nobj=100: button_container(nobj,600,800,"F I N")
nobj=110: button_container(nobj,600,700,"Aide")
nobj=120: compteur(nobj,0,500,100,"Compteur")
nobj=130 :affichtxt(nobj,600,450,14,date$)
nobj=140:help(nobj,0,"Aide")
gosub manu :gosub capteur
on_click 82, verinAV
on_click 92, verinAR
on_click 72, auto
on_click 74, manu
on_click 101,sp_fin
on_click 123, raz
on_click 111, help1
on_click 142, help0
  ' ========
   end
  ' ========
 sp_fin:
 terminate
 return

 rem ============================

verinAV:
 color 82,22,184,78
 pause 500
color 82,84,249,141
vav:
if position(62) > 95 then return
for i= 10 to 100
pause 20
gosub capteur
position 62,i
next i
if a=1
compt$="0000"
c=c+1:compt$=compt$+ str$(c)
compt$=right$(compt$,4)
caption 122,compt$
end_if
return
' =======================
verinAR:
 color 92,22,184,78
 pause 500
color 92,84,249,141
var:
if position(62) < 15 then return
for i=100 to 10 step -1
pause 15
position 62,i
gosub capteur
next i
return
' =====================
capteur:
if i <20
font_color 63,255,0,0
color 42,255,255,102
else
font_color 63,0,0,255
color 42,204,153,51
end_if
if i >90
font_color 64,255,0,0
color 52,255,255,102
else
font_color 64,0,0,255
color 52,204,153,51
end_if
caption 63,"[%]"
caption 64,"[%]"
return
' =========================
auto:
 a=1
color 72,22,184,78
color 74,222,41,22
color 22,0,255,0
color 32,204,102,0
inactive 82 :inactive 92
while a=1
   gosub vav
   pause 500
   gosub var
   pause 500
end_while
return
' ================
 manu:
a=0
active 82:active 92
color 72,84,249,141
color 74,174,74,52
color 22,0,153,0
color 32,255,153,0
return
'  =============
raz:
if a=0
c=0:caption 122,"0000"
end_if
return
'  =============
help1:
show 140:inactive 0
return
'  =============
help0:
hide 140:active 0
return


rem =======sub===============


sub affichtxt(nxt,tpt,ltt,fsize,txt$)
container nxt::top nxt,tpt:left nxt,ltt
Alpha nxt+1:parent nxt+1,nxt:top nxt+1,20:left nxt+1,10
font_bold nxt+1:font_size nxt+1,fsize:caption nxt+1,txt$
width nxt,width(nxt+1)+40
height nxt,height(nxt+1)+40
end_sub
rem ===========================
sub voyant(ntp,ttp,ltp,txt$,col$)
container ntp:top ntp,ttp:left ntp,ltp
width ntp,80: height ntp,133
if len(txt$) > 9 then txt$=left$(txt$,9)
caption ntp,txt$
alpha ntp+1:parent ntp+1,ntp:top ntp+1,48:left ntp+1,7
width ntp+1,64: height ntp+1,44:color ntp+1,0,0,0
alpha ntp+2:parent ntp+2,ntp:top ntp+2,52:left ntp+2,11
width ntp+2,56: height ntp+2,36
if col$ ="R" or col$ ="r" then color ntp+2,153,0,0
if col$ ="O" or col$ ="o" then color ntp+2,204,102,0
if col$ ="J" or col$ ="j" then color ntp+2,204,153,51
if col$ ="B" or col$ ="b" then color ntp+2,51,153,153
if col$ ="V" or col$ ="v" then color ntp+2,0,153,0
end_sub
rem  ntp=10 ==>voyant  =12
rem ===========================
sub verin(nv,tpv,ltv,txt$)
 container nv:top nv,tpv:left nv,ltv:caption nv,txt$
 alpha nv+1:parent nv+1,nv:top nv+1,50 :left nv+1,30
 width nv+1,120 :height nv+1,40
 color nv+1,102,129,141
 progress_bar nv+2 :parent nv+2,nv:top nv+2,60:left nv+2,30+width(nv+1)
 position nv+2,10
 width nv,width(nv+1)+width(nv+2)+60
 alpha nv+3:parent nv+3,nv:top nv+3,30:left nv+3,30:caption nv+3,"[%]"
 font_color nv+3,255,0,0
 alpha nv+4:parent nv+4,nv:top nv+4,30:left nv+4,135:caption nv+4,"[%]"
 font_color nv+4,0,0,255
 rem pour nv =10 %r==> 13 & %s==> 14
end_sub
rem ===========================
sub flip_flop(ntp,ttp,ltp,txt$)
container ntp:top ntp,ttp:left ntp,ltp
width ntp,80: height ntp,133
if len(txt$) > 9 then txt$=left$(txt$,9)
caption ntp,txt$
alpha ntp+1:parent ntp+1,ntp:top ntp+1,25:left ntp+1,19
width ntp+1,40: height ntp+1,40:color ntp+1,0,0,0
alpha ntp+2:parent ntp+2,ntp:top ntp+2,27:left ntp+2,21
width ntp+2,36: height ntp+2,36:color ntp+2,84,249,141
alpha ntp+3:parent ntp+3,ntp:top ntp+3,75:left ntp+3,19
width ntp+3,40: height ntp+3,40:color ntp+3,0,0,0
alpha ntp+4:parent ntp+4,ntp:top ntp+4,77:left ntp+4,21
width ntp+4,36: height ntp+4,36:color ntp+4,222,41,22
end_sub
rem ntp=10 ==>bp1 =12 / bp2 = 14
rem  on_clich 12 ou 14 ==>sp
rem ===========================
sub Bpvert(ntp,ttp,ltp,txt$)
container ntp:top ntp,ttp:left ntp,ltp
width ntp,80: height ntp,133
if len(txt$) > 9 then txt$=left$(txt$,9)
caption ntp,txt$
alpha ntp+1:parent ntp+1,ntp:top ntp+1,50:left ntp+1,19
width ntp+1,40: height ntp+1,40:color ntp+1,0,0,0
alpha ntp+2:parent ntp+2,ntp:top ntp+2,52:left ntp+2,21
width ntp+2,36: height ntp+2,36:color ntp+2,84,249,141
end_sub
rem  ntp=10 ==>bp1 =12
rem ===========================
sub button_container(nbc,tpc,ltc,txt$)
container nbc:top nbc,tpc:left nbc, ltc
caption nbc ,txt$
button nbc+1:parent nbc+1,nbc:top nbc+1,30:left nbc+1,10
width nbc+1,30
width nbc,width(nbc+1)+20
height nbc,height(nbc+1)+40
end_sub
rem ===========================
sub compteur(nc,par,tpc,ltc,txt$)
container nc:parent nc,par:top nc,tpc:left nc,ltc
caption nc,txt$
alpha nc+1:parent nc+1,nc:top nc+1,40:left nc+1,10
color nc+1,0,0,0
alpha nc+2:parent nc+2,nc:top nc+2,45:left nc+2,15
color nc+2,255,0,0:font_size nc+2,20:caption nc+2,"0000"
height nc+1,height(nc+2)+10
button nc+3 :parent nc+3,nc:top nc+3,45:left nc+3,width(nc+1)+20
width nc+3 ,30:caption nc+3,"RAZ"
width nc,width(nc+1)+width(nc+3)+30
' affichage nc+2 nc=10  ==>12
' bp nc+3 nc=10  ==>13
end_sub

rem ==============================
sub help(nform,visi,txt$)
 form nform : top nform,(screen_y-height(nform))/2 :left nform,(screen_x-width(nform))/2
 width nform,500:height nform,350:if visi = 0 then hide nform
 memo nform+1:parent nform+1,nform:full_space nform+1
 caption nform,txt$
 item_add nform+1,"                      "
 item_add nform+1,"La supervision est une technique industrielle de suivi et de pilotage informatique de procédés de fabrication automatisés. La supervision concerne l'acquisition de données (mesures, alarmes, retour d'état de fonctionnement) et des paramètres de commande des processus généralement confiés à des automates programmables."
 item_add nform+1,"                      "
 item_add nform+1,"Wikipédia, l'encyclopédie libre"
 item_add nform+1," "
item_add nform+1,"Mode d'emploi"
item_add nform+1,"Bouton-poussoir de couleur verte."
item_add nform+1,"Cycle ''Auto'' :"
item_add nform+1," la tige du vérin, elle sort et elle rentre automatiquement."
item_add nform+1,"Le compteur incrémente."
item_add nform+1," bouton-poussoir de couleur rouge."
item_add nform+1,"''Manu'':"
item_add nform+1,"Les boutons poussoirs ''V plus'' ''V moins '' pour déplacer la tige du vérin."
item_add nform+1,"''RAZ'' bouton-poussoir de remise à zéro du compteur"

 inactive nform+1
 button nform+2 :parent nform+2,nform:top nform+2,250:left nform+2,300
 caption nform+2,"Quitter"
' button 202 pour nforme =200
end_sub
 rem ==============================