⚲
Projet
Général
Profil
Connexion
S'enregistrer
Accueil
Projets
Aide
Recherche
:
Polytech Ge Sous Traitance
Tous les projets
Polytech Projets Ge
»
Polytech Ge Sous Traitance
Aperçu
Activité
Roadmap
Demandes
Gantt
Calendrier
Annonces
Documents
Wiki
Fichiers
Dépôt
Télécharger (1,49 ko)
Support #11756
» sketch_nov27a.ino
Anonyme, 06/12/2019 14:33
#define TAILLE_TABLEAU 50
#include
<string.h>
String
message
=
"R01:+01;R02:-02;R03:+03;R04:+04;R05:-05;R06:-06;R07:-07;R08:-08;R09:+09;\
;R10:-10;R11:-11;R12:-12;R13:-13;R14:+14;R15:+15;R16:+16;R17:+17;;R18:+18;R19:+19;R20:-20\
R01:+01;R02:-02;R03:+03;R04:+04;R05:-05;R06:-06;R07:-07;R08:-08;R09:+09;\
;R10:-10;R11:-11;R12:-12;R13:-13;R14:+14;R15:+15;R16:+16;R17:+17;;R18:+18;R19:+19;R20:-20\
R01:+01;R02:-02;R03:+03;R04:+04;R05:-05;R06:-06;R07:-07;R08:-08;R09:+09;R10:-10"
;
String
tableau_message
[
TAILLE_TABLEAU
];
int
i
;
void
setup
()
{
// put your setup code here, to run once:
Serial
.
begin
(
9600
);
}
void
recu
(){
int
commPosition
;
//
String
token
;
int
token_entier
;
do
{
commPosition
=
message
.
indexOf
(
':'
);
// des qu'il recoit ":" , il donne la position
if
(
commPosition
!=
-
1
)
{
token
=
message
.
substring
(
commPosition
+
1
,
commPosition
+
4
);
token_entier
=
token
.
toInt
();
//
tableau_message
[
i
]
=
token_entier
;
i
++
;
Serial
.
println
(
token_entier
);
// envoi de token entier sur linterface serie donc en gros c notre valeur de trame deja decode, valeur en int de la position en degre quu doit etre bouge par le moteur
message
=
message
.
substring
(
commPosition
+
5
,
message
.
length
());
}
}
while
(
commPosition
>=
0
);
// while(Serial.read()>=0){};
}
void
loop
()
{
// put your main code here, to run repeatedly:
delay
(
500
);
recu
();
}
« Précédent
1
2
3
Suivant »
(3-3/3)
Chargement...