samedi 11 janvier 2014

 Mise à jour du programme en "Panoramic"

pour dégrossir les codes en "C" pour "arduino Uno"

en attente d'un éditeur en Panoramic pour programmer directement ces interfaces.
  je vous propose une appli en Panoramic pour dégrossir le programme de arduino.
  dont 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 appui sur le bouton "-+"  Ide de l'interface apparaît, coller le programme dans  ide arduino
  pour contrôler debugger et transférer vers l'interface.
  vous avez la possibilité de charger et sauvegarder le programme

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



Code:

' le site www.mon-club-elec.fr
' http://www.mon-club-elec.fr/pmwiki_reference_arduino/pmwiki.php?n=Main.Serial
' http://blog.pepita.org/?wpfb_dl=7"
' http://www.doctormonk.com/2012/01/arduino-timer-library.html
' http://panoramicetardinouno.blogspot.fr/
'  ===================================================
 error_french
 width 0,1200:height 0,1000: color 0,0,103,153:caption 0,"Editeur en Panoramic pour langage arduino"
 top 0,(screen_y-height(0))/2 :left 0,(screen_x-width(0))/2
 label sp_100,sp_11,sp_12,sp_13,sp_16,sp_200,sp_Save,sp_Open,sp_FIN,langage_arduino_1
 label sp_cls,uno,translate,sp_9,sp_30,sp_31,sp_32,sp_33,sp_30_hide,sp_34 ,sp_35
 dim m ,i ,j,l,acold,acolf,a$,car$ ,f$
 memo 100:top 100,40:left 100,200:width 100,950:height 100,900
   bar_both 100:font_size 100,14: color 100,220,220,220
   font_name 100,"DejaVu Sans Mono"
 list 200:top 200,40:left 200,20:gosub langage_arduino_1
   width 200,170:height 200, 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,"Ide 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,"Vérifier accolade"::width 9,27
 button 11:top 11,8 :left 11,50 :width 11,27:font_name 11,"webdings"
   font_size 11,15:hint 11,"copier":caption 11,"ª"
 button 12:top 12,8 :left 12,100 :width 12,27:font_name 12,"webdings"
   font_size 12,15:hint 12,"coller":caption 12,"¥"
 button 13:top 13,8 :left 13,150 :width 13,27
   font_size 13,15:hint 13,"accolade {":caption 13,"{"

 open_dialog 14:save_dialog 15:dir_dialog 14,dir_current$:dir_dialog 15,dir_current$

 button 16:top 16,8 :left 16,200 :width 16,27
   font_size 16,15:hint 16,"accolade }":caption 16,"}"
 container 30:height 30,180
  top 30,(height(0)-height(30))/2 :left 30,(width(0)-width(30))/2
  hide 30 :caption 30,"  HELP  ":color 30,0,103,20:font_color 30,255,255,255
  hint 30,"double_click pour Fin"
 button 31:top 31,20 :left 31,(width(30)-width(31))/2:parent 31,30:caption 31,"Aide Arduino 1"
 button 32:top 32,50 :left 32,(width(30)-width(32))/2:parent 32,30:caption 32,"Aide Arduino 2"
 button 33:top 33,80 :left 33,(width(30)-width(33))/2:parent 33,30:caption 33,"Aide Arduino 3"
 button 34:top 34,110 :left 34,(width(30)-width(34))/2:parent 34,30:caption 34,"Aide Arduino 4"
 button 35:top 35,140 :left 35,(width(30)-width(35))/2:parent 35,30:caption 35,"Mon Blog"

 on_click 1,sp_cls:on_click 2,sp_Save:on_click 3,sp_Open
 on_click 4,sp_FIN:on_click 6, sp_30
 on_click 7,uno:on_click 8,translate
 on_close 0,sp_save :on_click 9,sp_9
 on_click 100 ,sp_100:on_click 200 ,sp_200
 on_click 11 ,sp_11:on_click 12 ,sp_12
 on_click 13 ,sp_13:on_click 16 ,sp_16
 on_click 31,sp_31:on_click 32,sp_32
 on_click 33,sp_33:on_double_click 30,sp_30_hide
 on_click 34,sp_34:on_click 35,sp_35
'  =======================
 end
'  =======================
sp_9:
 acold=0:acolf=0
 for i=1 to count(100)
    a$=item_read$(100,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 100,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 100,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 100
return
'  =======================
sp_100:
width 100,width(0)-left(100)-20:return
'  =======================
sp_11:
clipboard_copy 100:return
'  =======================
sp_12:
clipboard_paste 100:return
'  =======================
sp_13:
item_add 100,"{":return
'  =======================
sp_16:
item_add 100,"}":return
'  =======================
sp_200:
 clipboard_string_copy  item_read$(200,item_index(200))+chr$(13)+chr$(10)
return
'  =======================
 langage_arduino_1:
 ' ............................
 item_add 100,"void setup() {"
 item_add 100,"// mettre votre code d'installation ici:"
 item_add 100,"  "
 item_add 100,"  }"
 item_add 100,"void loop() {"
 item_add 100,"// mettre votre code principal ici, à exécuter à plusieurs reprises:"
 item_add 100,"  "
 item_add 100,"  }"
 ' ...............................
 item_add 200,"/* début rem multiligne"
 item_add 200,"fin rem multilignes */"
 item_add 200,"#include <librairie >"
 item_add 200,"#define constantnom val"
 item_add 200,"int var = val;"
 item_add 200,"boolean var=false; // ou true"
 item_add 200,"char monChar='B';"
 item_add 200,"long var = valeur;"
 item_add 200,"float var = valeur;// 10,5 (nombres à virgules)"
 item_add 200,"char Str[15];"
 item_add 200,"String lettre;"
 item_add 200,"// ===rem_1_ligne======="
 item_add 200,"void setup() { //code }"
 item_add 200,"pinMode(N°Pin,OUTPUT);"
 item_add 200,"pinMode(N°Pin,INPUT);"
 item_add 200,"// ================"
 item_add 200,"void loop() { //code }"
 item_add 200,"digitalWrite(N°Pin, HIGH);"
 item_add 200,"digitalWrite(N°Pin, LOW);"
 item_add 200," val = digitalRead(N°Pin);"
 item_add 200,"val = analogRead(analogPin);"
 item_add 200,"analogWrite(N°Pin, val);"
 item_add 200,"for (i=0; i <= 255;  i++) {//instruction(s)à exécuter;}"
 item_add 200,"if (Variable > 50){ //action }"
 item_add 200,"if (x == y ){ //action }//(x est égal à y)"
 item_add 200,"if (x != y ){ //action }//(x est différent de y)"
 item_add 200,"if (x < y ){ //action }//(x est inférieur à y)"
 item_add 200,"if (x > y){ //action }// (x est supérieur à y)"
 item_add 200,"if (x <= y){ //action }// (x est inférieur ou égal à y)"
 item_add 200,"if (x >= y){ //action }// (x est supérieur ou égal à y)"
 item_add 200,"if (x == y ){ //action a }"
 item_add 200," else  { //action b }"
 item_add 200,"switch (var) { // début de la structure"
 item_add 200,"case 1: // cas 1"
 item_add 200,"break;"
 item_add 200," default: // cas par défaut"
 item_add 200,"} // fins witch"
 item_add 200,"while(Serial.available()){ //code }"
 item_add 200," delay (ms);"
 item_add 200,"mon_sous_programme();"
 item_add 200,"void mon_sous_programme(){ //code }"
 item_add 200,"var=min(x, y);"
 item_add 200,"var=max(x, y);"
 item_add 200,"var=abs(x);"
 item_add 200,"var=constrain(x, a, b),"
 item_add 200,"var=sq(x);"
 item_add 200,"var=sqrt(x);"
 item_add 200,"var=sin(rad);"
 item_add 200,"var=cos(rad);"
 item_add 200,"var=tan(rad);"
 item_add 200,"valeur=chiffre.toInt();"
 item_add 200,"Serial.begin(int vitesse);"
 item_add 200,"Serial.available();"
 item_add 200,"Serial.read();"
 item_add 200,"Serial.print(données);"
 item_add 200,"Serial.println(data);"
 item_add 200,"Serial.println(data);"
 ' librairie  MuxShield 12 2012 MuxShield
' item_add 20,"#include <MuxShield.h>"
' item_add 20,"MuxShield muxShield;"
' item_add 20,"muxShield.setMode(1,ANALOG_IN);"
' item_add 20,"muxShield.setMode(1,DIGITAL_IN);"
' item_add 20,"muxShield.setMode(1,DIGITAL_IN_PULLUP);  //set I/O 1 as digital in with pullup"
' item_add 20,"muxShield.setMode(1,DIGITAL_OUT);"
' item_add 20,"digital1 = muxShield.digitalReadMS(1,0);  //IO1, pin 0 "
' item_add 20,"muxShield.digitalWriteMS(2,2,HIGH);  //IO2, pin 2"
' item_add 20,"analog1 = muxShield.analogReadMS(3,14);  //IO3, pin 14"
item_add 200,"// ================"
item_add 200,"// librairie  MuxShield v0.1"
item_add 200,"#include <MuxShield.h>"
item_add 200,"Mux mux = Mux();"
item_add 200,"mux.control();"
item_add 200,"mux.io("+chr$(34)+"DO"+chr$(34)+", 0, 0, 1);"
item_add 200,"mux.io("+chr$(34)+"DO"+chr$(34)+", 0, 0, 0);"
item_add 200,"mux.io("+chr$(34)+"DI"+chr$(34)+", 1, 0, 1);"
item_add 200,"var=mux.lecturadigital(1);"
item_add 200,"mux.io("+chr$(34)+"DI"+chr$(34)+", 1, 0, 0);"
item_add 200,"mux.lecturaanalogica(2, 0);"

item_add 200,"// ================"
' libairy_timer_h
item_add 200,"#include <Timer.h>"
item_add 200,"Timer t;"
item_add 200,"t.oscillate(3, 100, LOW);//dans void setup()"
item_add 200,"ledEvent = t.oscillate(13, 50, HIGH);//dans void setup()"
item_add 200,"t.oscillate(13, 500, HIGH, 5);//void sous programme()"
item_add 200,"t.every(1000, sous programme);//dans void setup()"
item_add 200,"int variable = t.every(2000, sous programme);//dans void setup()"
item_add 200,"t.every(1000, sous programme, int Nombre de répétition)"
item_add 200,"t.after(10000, sous programme);//dans void setup()"
item_add 200,"int variable  = t.after(10000, sous programme);//dans void setup()"
item_add 200,"t.pulse(pin, 10 * 60 * 1000, HIGH);;//dans void setup()"
item_add 200,"t.update();//dans void loop()"
item_add 200,"t.stop(variable ou pin );//void sous programme()"


return
'  =======================
sp_30_hide:
hide 30:return
'  =======================
sp_30:
show 30:return
'  =======================
sp_31:
 execute "chrome.exe http://www.ele.uri.edu/courses/ele205/Arduino%20-%20Reference.pdf"
hide 30:return
'  =======================
sp_32:
execute "chrome.exe http://blog.pepita.org/?wpfb_dl=7"
hide 30:return
'  =======================
sp_33:
execute "chrome.exe http://www.mon-club-elec.fr/pmwiki_reference_arduino/pmwiki.php?n=Main.Reference"
hide 30:return
'  =======================
sp_34:
execute "chrome.exe http://www.doctormonk.com/2012/01/arduino-timer-library.html"
hide 30:return
'  =======================
sp_35:
execute "chrome.exe http://panoramicetardinouno.blogspot.fr/"
hide 30:return

'  =======================
translate:
execute "chrome.exe http://translate.google.fr/#en/fr/"
return





Aucun commentaire:

Enregistrer un commentaire