Tom's Guide > Forum > Programmation > Explication code language basic

Explication code language basic

Forum Programmation : Explication code language basic

TomsGuide.com : 800 000 inscrits répondent à toutes vos questions high-tech et informatique. Pour obtenir de l'aide, inscrivez-vous gratuitement !
Mot :    Pseudo :           
 

Qui pourrait me traduire se language basic en c++ ou c# (encore mieu) :

=> Afin de programmer une boussole éléctronique !

Programme 1
Ce programme affiche la position en ° de la boussole.

DIM I AS INTEGER, J AS INTEGER
CONST MAX = 1800
CONST VALEUR_MIN = 800

SET PICBUS HIGH
LCDINIT
CSROFF
10 I=CAPTURE(0,1)
I=I*4 ' Conversion en microseconde
I=I-1000 ' Gestion de l'offset
I=I/100 ' Affichage 100 microseconde par degré
LOCATE 0,0
PRINT DEC(I,3,0)
GOTO 10



Programme 2
Ce programme affiche sur la première ligne de l'afficheur les points cardinaux (NO ES SU OU). Sur la seconde ligne, un point se déplace sous les indications en fonction de votre orientation.

DIM I AS INTEGER, J AS INTEGER
CONST MAX = 1800
CONST VALEUR_MIN = 800
SET PICBUS HIGH
LCDINIT
LOCATE 0,0
PRINT "O ES SU OU N"
10 I=CAPTURE(0,1)
I=I*4 ' Conversion en microseconde
I=I-1000 ' Gestion de l'offset
I=I/100 ' Affichage 100 microseconde par degre
J=I/22
LOCATE 0,1
PRINT " "
LOCATE J,1
PRINT "O"
CSROFF
GOTO 10



Programme 3
Ce programme affiche la position en ° de la boussole ainsi que les positions principales en "clair" (Nord / Nord - est / Est / Sud - est / Sud....). De plus grâce à une redéfinition de caractères de l'afficheur, une petite flèche a été crée, laquelle représente une boussole mécanique qui vous indiquera la position à l'écran en tournant sur elle même.

DIM I AS INTEGER, J AS INTEGER
CONST MAX = 1800
CONST VALEUR_MIN = 800
SET PICBUS HIGH
LCDINIT
10 I=CAPTURE(0,1)
I=I*4 ' Conversion en microseconde
I=I-1000 ' Gestion de l'offset
I=I/100 ' Affichage 100 microseconde par degre
LOCATE 0,0
PRINT DEC(I,3,0)
CSROFF
IF (I>338 OR I<22) THEN GOSUB NORD
IF (I>22 AND I<68) THEN GOSUB NE
IF (I>68 AND I<112) THEN GOSUB EST
IF (I>112 AND I<158) THEN GOSUB SE
IF (I>158 AND I<202) THEN GOSUB SUD
IF (I>202 AND I<248) THEN GOSUB SO
IF (I>248 AND I<292) THEN GOSUB OUEST
IF (I>292 AND I<338) THEN GOSUB NO
GOTO 10

NORD: LOCATE 5,0
PRINT "NORD "
BUSOUT &HA5,9,0,&H4,&HE,&H1F,&H1F,&H4,&H4,0
LOCATE 1,1
PRINT 9
RETURN

NE: LOCATE 5,0
PRINT "NORD - EST "
BUSOUT &HA5,9,0,&HF,&H7,&H7,&H9,&H10,&H0,0
LOCATE 1,1
PRINT 9
RETURN

OUEST: LOCATE 5,0
PRINT "OUEST "
BUSOUT &HA5,9,0,&H4,&H0C,&H1F,&H1F,&H0C,&H4,0
LOCATE 1,1
PRINT 9
RETURN

EST: LOCATE 5,0
PRINT "EST "
BUSOUT &HA5,9,0,&H4,&H6,&H1F,&H1F,&H6,&H4,0
LOCATE 1,1
PRINT 9
RETURN

NO: LOCATE 5,0
PRINT "NORD - OUEST"
BUSOUT &HA5,9,0,&H1E,&H1C,&H1C,&H12,&H1,&H0,0
LOCATE 1,1
PRINT 9
RETURN

SUD: LOCATE 5,0
PRINT "SUD "
BUSOUT &HA5,9,0,&H4,&H4,&H1F,&H1F,&HE,&H4,0
LOCATE 1,1
PRINT 9
RETURN

SO: LOCATE 5,0
PRINT "SUD - OUEST"
BUSOUT &HA5,9,0,0,&H1,&H12,&H1C,&H1C,&H1E,0
LOCATE 1,1
PRINT 9
RETURN

SE: LOCATE 5,0
PRINT "SUD - EST "
BUSOUT &HA5,9,0,0,&H10,&H9,&H7,&H7,&HF,0
LOCATE 1,1
PRINT 9
RETURN

Liens sponsorisés
Inscrivez-vous ou connectez-vous pour masquer ceci.
Tom's Guide > Forum > Programmation > Explication code language basic
Aller à :

Il y a 448 utilisateurs connus et inconnus. Pour voir la liste des connectés connus, cliquez ici.

Attention

Vous allez répondre sur un sujet resté inactif pendant plus de 6 mois.
Assurez-vous d'apporter des éléments nouveaux à la discussion avant de poursuivre.

Répondre Annuler
Liens