Précédent   Forum du club des développeurs et IT Pro > Autres langages > Autres langages > Basic
Basic Forum d'entraide sur la programmation en langage Basic
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 04/10/2011, 18h28   #1
Fikken
Invité de passage
 
Homme Fahim IKKEN
Technicien maintenance
Inscription : octobre 2011
Messages : 3
Détails du profil
Informations personnelles :
Nom : Homme Fahim IKKEN
Localisation : France, Paris (Île de France)

Informations professionnelles :
Activité : Technicien maintenance
Secteur : Transports

Informations forums :
Inscription : octobre 2011
Messages : 3
Points : 0
Points : 0
Par défaut [CUBLOC] Comment attribuer une variable à un champ texte d'un formulaire

Bonjour à tous,

j'ai écris ce petit programme en basic dédié aux microcontrôleurs Cubloc, qui permet de mesurer et contrôler les entrées sorties de ce dernier via internet (par interface web en xhtml), par contre je ne sais pas comment attribuer une variable (ici temp) à un champ texte d'un formulaire. Ci joint le programme du Cubloc. Quel champs utiliser pour afficher à l'utilisateur distant via son ihm web la valeur de la variable temp? Merci par avance à tous ceux ou celles qui voudront bien m'aider.


Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
'*********************************************************
' Programme de mise en oeuvre d'un CB405, EZL 50, DS1620 *
'*********************************************************
 
'Partie declarations
Const Device = CB405
Delay 100
Opencom 2,19200,3,512,512
Delay 100
Set Display 2,0,0,50
Delay 100
Set I2c 45, 44
Dim a As Integer
Const iorst = 5 'Broche Reset du Thermometre DS1620
Const ioclk = 6 'Broche Clock du Thermometre DS1620
Const iodq = 27 'Broche Data du Thermometre DS1620
Dim temp As Integer
Dim RS232_C2 As String 'Carte reseau
Dim ADC0 As Integer
Cls
Delay 1000
Do
 
- 	'Partie acquisition Temperature
High iorst
Shiftout ioclk,iodq,0,12,8
Shiftout ioclk,iodq,0,3,8
Low iorst
High iorst
Shiftout ioclk,iodq,0,&hEE,8
Low iorst
High iorst
Shiftout ioclk,iodq,0,&haa,8
temp = Shiftin(ioclk,iodq,4,9)
temp = temp
temp = temp/2.5
Low iorst
Delay 100
 
'Partie acquisition entrees analogiques
ADC0 = Tadin(0)
Delay 200
Locate 0,0
Print "In ADC0 =", Dec4 ADC0
Delay 200
Locate 0,1
Print "In Temp = ", Dec3 temp
Delay 200
 
- 	'Partie HTTP
If Blen(2,0)>0 Then
Delay 100
RS232_C2 = Getstr(2,255)
Delay 1000
If Left(RS232_C2,16) = "GET /?Sortie1=On" Then
a=Outstat(32)
If a=0 Then
High 32
Locate 0,2
Print "Out ADC8 = On "
Beep 7,300
Endif
Endif
If Left(RS232_C2,16) = "GET /?Sortie1=Of" Then
a=Outstat(32)
If a=1 Then
Low 32
Locate 0,2
Print "Out ADC8 = Off"
Beep 7,100
Endif
Endif
If Left(RS232_C2,5) = "GET /" Then
Putstr 2, "HTTP/1.1 200 OK", 13, 10
Delay 100
Putstr 2, "Connection : Close", 13, 10
Delay 100
Putstr 2, "Content-type : text/HTML", 13, 10
Delay 100
Putstr 2, "Contet-Length : 512", 13, 10
Delay 100
Putstr 2, 10,13
Delay 100
 
'Partie XHTML
Putstr 2, "<!DOCTYPE html PUBLIC &h22;-//W3C//DTD XHTML 1.0 Strict//EN&h22; &h22;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&h22;>", 10, 13
Putstr 2, "<html xmlns=&h22;<a href="http://www.w3.org/1999/xhtml&h22;" target="_blank">http://www.w3.org/1999/xhtml&h22;</a> xml:lang=&h22;fr&h22;>", 10, 13
Putstr 2, "<head><meta http-equiv=&h22;Content-type&h22; content=&h22;text/html; charset=utf-8&h22; /><title>Site de Fahim IKKEN</title></head>",10,13
Delay 200
Putstr 2, "<body><h1>Mesure & Commande Via Internet</h1><form name=formulaire method=post,>Etat de la sortie P32:<Input type=radio name=Sortie1 value=On>On<Input type=radio name=Sortie1 value=Off>Off<br><Input type=submit name=Bouton value=Envoyer></form></body></html>",10,13
Delay 200
Endif
Endif
Loop
Fikken est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/10/2011, 21h43   #2
12monkeys
Responsable (X)HTML/CSS
 
Avatar de 12monkeys
 
Homme Christophe F.
Webmaster
Inscription : novembre 2006
Messages : 4 025
Détails du profil
Informations personnelles :
Nom : Homme Christophe F.
Âge : 36
Localisation : France, Puy de Dôme (Auvergne)

Informations professionnelles :
Activité : Webmaster
Secteur : Service public

Informations forums :
Inscription : novembre 2006
Messages : 4 025
Points : 9 111
Points : 9 111
Bonsoir

C'est ici que ça se passe pour comprendre le HTML : http://j-willette.developpez.com/tut...bases-du-html/

Pour afficher une valeur dans un champ texte il faut rempli l'attribut value="" avec ta variable.

Code :
<input type="text" name="nom_champ" value="la valeur affichée">
__________________
Vous souhaitez participer à la rubrique (X)HTML/CSS, contactez moi.
débutez avec les CSS
Pas de MP pour des questions techniques ! Mode d'emploi du forum ; Règles ; Pensez à la balise code ; Pas de SMS !
Votez pour les messages qui vous ont aidés...
12monkeys est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/10/2011, 12h29   #3
Fikken
Invité de passage
 
Homme Fahim IKKEN
Technicien maintenance
Inscription : octobre 2011
Messages : 3
Détails du profil
Informations personnelles :
Nom : Homme Fahim IKKEN
Localisation : France, Paris (Île de France)

Informations professionnelles :
Activité : Technicien maintenance
Secteur : Transports

Informations forums :
Inscription : octobre 2011
Messages : 3
Points : 0
Points : 0
Par défaut Re 12Monkeys

Bonjour et merci 12Monkeys,
tu penses bien que je connais l'attribut Value vu que je l'utilise sur d'autres balises Input. Mais le champ texte affiche le nom de la variable et non pas son contenu qui doit être numérique ex: 24,2. C'est peut-être au niveau de mon programme Basic pour les cubloc?
Voici la doc du Cubloc, encore merci pour d'autres solutions.

http://www.lextronic.fr/~lextronic_doc/CUBLOC.pdf
Fikken est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/10/2011, 12h35   #4
tumoo
Membre expérimenté
 
Avatar de tumoo
 
Homme
Développeur informatique
Inscription : janvier 2011
Messages : 309
Détails du profil
Informations personnelles :
Sexe : Homme
Âge : 23
Localisation : France, Charente Maritime (Poitou Charente)

Informations professionnelles :
Activité : Développeur informatique
Secteur : Industrie

Informations forums :
Inscription : janvier 2011
Messages : 309
Points : 530
Points : 530
Salut

Tu peux nous montrer le code que tu utilises quand tu veux afficher cette variable stp
tumoo est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/10/2011, 13h28   #5
12monkeys
Responsable (X)HTML/CSS
 
Avatar de 12monkeys
 
Homme Christophe F.
Webmaster
Inscription : novembre 2006
Messages : 4 025
Détails du profil
Informations personnelles :
Nom : Homme Christophe F.
Âge : 36
Localisation : France, Puy de Dôme (Auvergne)

Informations professionnelles :
Activité : Webmaster
Secteur : Service public

Informations forums :
Inscription : novembre 2006
Messages : 4 025
Points : 9 111
Points : 9 111
Dans ce cas c'est lié à ton programme "basic" et n'a rien à voir avec le HTML !
__________________
Vous souhaitez participer à la rubrique (X)HTML/CSS, contactez moi.
débutez avec les CSS
Pas de MP pour des questions techniques ! Mode d'emploi du forum ; Règles ; Pensez à la balise code ; Pas de SMS !
Votez pour les messages qui vous ont aidés...
12monkeys est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/10/2011, 16h04   #6
Fikken
Invité de passage
 
Homme Fahim IKKEN
Technicien maintenance
Inscription : octobre 2011
Messages : 3
Détails du profil
Informations personnelles :
Nom : Homme Fahim IKKEN
Localisation : France, Paris (Île de France)

Informations professionnelles :
Activité : Technicien maintenance
Secteur : Transports

Informations forums :
Inscription : octobre 2011
Messages : 3
Points : 0
Points : 0
Citation:
Envoyé par tumoo Voir le message
Salut

Tu peux nous montrer le code que tu utilises quand tu veux afficher cette variable stp
Bonjour, voici mon programme écris en basic dédié aux microcontroleurs CB405.
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 '*********************************************************
' Programme de mise en oeuvre d'un CB405, EZL 50, DS1620 *
'*********************************************************
 
'Partie declarations
Const Device = CB405
Delay 100
Opencom 2,19200,3,512,512
Delay 100
Set Display 2,0,0,50
Delay 100
Set I2c 45, 44
Dim a As Integer
Const iorst = 5 'Broche Reset du Thermometre DS1620
Const ioclk = 6 'Broche Clock du Thermometre DS1620
Const iodq = 27 'Broche Data du Thermometre DS1620
Dim temp As Integer
Dim RS232_C2 As String 'Carte reseau
Dim ADC0 As Integer
Cls
Delay 1000
Do
 
- 	'Partie acquisition Temperature
High iorst
Shiftout ioclk,iodq,0,12,8
Shiftout ioclk,iodq,0,3,8
Low iorst
High iorst
Shiftout ioclk,iodq,0,&hEE,8
Low iorst
High iorst
Shiftout ioclk,iodq,0,&haa,8
temp = Shiftin(ioclk,iodq,4,9)
temp = temp
temp = temp/2.5
Low iorst
Delay 100
 
'Partie acquisition entrees analogiques
ADC0 = Tadin(0)
Delay 200
Locate 0,0
Print "In ADC0 =", Dec4 ADC0
Delay 200
Locate 0,1
Print "In Temp = ", Dec3 temp
Delay 200
 
- 	'Partie HTTP
If Blen(2,0)>0 Then
Delay 100
RS232_C2 = Getstr(2,255)
Delay 1000
If Left(RS232_C2,16) = "GET /?Sortie1=On" Then
a=Outstat(32)
If a=0 Then
High 32
Locate 0,2
Print "Out ADC8 = On "
Beep 7,300
Endif
Endif
If Left(RS232_C2,16) = "GET /?Sortie1=Of" Then
a=Outstat(32)
If a=1 Then
Low 32
Locate 0,2
Print "Out ADC8 = Off"
Beep 7,100
Endif
Endif
If Left(RS232_C2,5) = "GET /" Then
Putstr 2, "HTTP/1.1 200 OK", 13, 10
Delay 100
Putstr 2, "Connection : Close", 13, 10
Delay 100
Putstr 2, "Content-type : text/HTML", 13, 10
Delay 100
Putstr 2, "Contet-Length : 512", 13, 10
Delay 100
Putstr 2, 10,13
Delay 100
 
'Partie XHTML
Putstr 2, "<!DOCTYPE html PUBLIC &h22;-//W3C//DTD XHTML 1.0 Strict//EN&h22; &h22;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&h22;>", 10, 13
Putstr 2, "<html xmlns=&h22;<a href="http://www.w3.org/1999/xhtml&h22;" target="_blank">http://www.w3.org/1999/xhtml&h22;</a> xml:lang=&h22;fr&h22;>", 10, 13
Putstr 2, "<head><meta http-equiv=&h22;Content-type&h22; content=&h22;text/html; charset=utf-8&h22; /><title>Site de Fahim IKKEN</title></head>",10,13
Delay 200
Putstr 2, "<body><h1>Mesure & Commande Via Internet</h1><form name=formulaire method=post,>Etat de la sortie P32:<Input type=radio name=Sortie1 value=On>On<Input type=radio name=Sortie1 value=Off>Off<br><Input type=submit name=Bouton value=Envoyer></form></body></html>",10,13
Delay 200
Endif
Endif
Loop
Fikken est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 11h52.


 
 
 
 
Partenaires

Hébergement Web