test moteurs

This commit is contained in:
Forest 2017-05-02 18:14:26 +02:00
parent 166879222f
commit 905bfe343b
6 changed files with 59 additions and 0 deletions

BIN
Test moteurs/moteur Executable file

Binary file not shown.

58
Test moteurs/moteur.c Normal file
View file

@ -0,0 +1,58 @@
#include <stdlib.h>
#include <stdio.h>
int main(){
FILE* fichier;
char* port_serie = "/dev/ttyACM0";
char buffer[30];
char c = '1';
double angle[2];
fichier = fopen(port_serie,"r+");
if(fichier==NULL){
printf("Impossible d'ouvrir %s\n",port_serie);
return 0;
}
while(c != 'q'){
printf("Valeurs moteurs xxx et yyy actuelles :\n");
read(angle,sizeof(double),1,fichier);
read(angle+1,sizeof(double),1,fichier);
//fscanf(fichier,"%d %d",angle,angle+1);
printf("\nxxx=%lf; yyy=%lf\n",angle[0]*0.001,angle[1]*0.001);
/*
fichier = fopen(port_serie,"w+");
if(fichier==NULL){
printf("Impossible d'ouvrir %s\n",port_serie);
return 0;
}*/
printf("\n Valeurs moteurs xxx,yyy ?\n");
scanf("%lf %lf",angle,angle+1);
fprintf(fichier,"%lf %lf",angle[0]*0.001,angle[1]*0.001);
/*
fwrite(angle,1,sizeof(int),fichier);
fwrite(angle+1,1,sizeof(int),fichier);*/
printf("\nq pour quitter\n");
c = getchar();
c = getchar();
}
fclose(fichier);
return 0;
}

1
Test moteurs/t.txt Normal file
View file

@ -0,0 +1 @@
1 1

BIN
Test moteurs/tt.txt Normal file

Binary file not shown.

0
Test moteurs/ttyACM0 Normal file
View file

0
code moteurs/.Rhistory Normal file
View file