scribing robot see https://hackaday.io/project/153194/

Dependencies:   mbed

See description of the project here: https://hackaday.io/project/153194/

Committer:
Leon
Date:
Sun Apr 22 13:57:53 2018 +0000
Revision:
0:694620b4c620
Child:
1:163fa4a925d9
a

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Leon 0:694620b4c620 1 #include "mbed.h"
Leon 0:694620b4c620 2 #include "time.h"
Leon 0:694620b4c620 3
Leon 0:694620b4c620 4 #define servo_stylo_pos 1800//1800
Leon 0:694620b4c620 5 #define servo_stylo_lev 1680//1680
Leon 0:694620b4c620 6 #define servo_neutre 1400
Leon 0:694620b4c620 7 #define servo_gomme_lev 900//900
Leon 0:694620b4c620 8 #define servo_gomme_pos 755//730 780
Leon 0:694620b4c620 9
Leon 0:694620b4c620 10 DigitalOut myled(LED1);
Leon 0:694620b4c620 11 DigitalOut led_err(LED3);
Leon 0:694620b4c620 12 DigitalOut stepper_clk_1(p21);//21
Leon 0:694620b4c620 13 DigitalOut stepper_dir_1(p22);//22
Leon 0:694620b4c620 14 DigitalOut stepper_clk_2(p23);//23
Leon 0:694620b4c620 15 DigitalOut stepper_dir_2(p24);//24
Leon 0:694620b4c620 16 DigitalOut servoout(p17);
Leon 0:694620b4c620 17 AnalogIn potard_1 (p20);
Leon 0:694620b4c620 18 DigitalIn switch_epaule(p18);
Leon 0:694620b4c620 19 DigitalIn switch_coude(p19);
Leon 0:694620b4c620 20 Serial pc(USBTX, USBRX);
Leon 0:694620b4c620 21 LocalFileSystem local("local");
Leon 0:694620b4c620 22
Leon 0:694620b4c620 23 Timeout pulse_stepper1;
Leon 0:694620b4c620 24 Timeout pulse_stepper2;
Leon 0:694620b4c620 25 Timeout servo_timeout;
Leon 0:694620b4c620 26 Ticker appel_servo;
Leon 0:694620b4c620 27
Leon 0:694620b4c620 28 int cons_servo_main=1400; //1800
Leon 0:694620b4c620 29 int a_coude, a_epaule, dir_1_real, dir_2_real, tick_attached_coude, tick_attached_epaule;
Leon 0:694620b4c620 30 int period_stepper1, period_stepper2, precis, outil, ligne;
Leon 0:694620b4c620 31 float X_pos, Y_pos;
Leon 0:694620b4c620 32 float X_print, Y_print, X_fictif;
Leon 0:694620b4c620 33 int remplissage[5]= {0,0,0,0,0};
Leon 0:694620b4c620 34 char texte_heure_bk[10];
Leon 0:694620b4c620 35 char texte_minute_bk[10];
Leon 0:694620b4c620 36
Leon 0:694620b4c620 37 float taille_glob;
Leon 0:694620b4c620 38
Leon 0:694620b4c620 39 char police_maj[256][30]= {
Leon 0:694620b4c620 40 5,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //32 espace
Leon 0:694620b4c620 41 ,2,2,15,3,2,5,6,2,1,5,4,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //33 !
Leon 0:694620b4c620 42 ,2,1,15,3,1,11,2,4,15,3,4,11,5,5,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //34 "
Leon 0:694620b4c620 43 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //35
Leon 0:694620b4c620 44 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //36
Leon 0:694620b4c620 45 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //37 %
Leon 0:694620b4c620 46 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //38 &
Leon 0:694620b4c620 47 ,2,3,15,3,1,11,5,4,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //39 ' appostrophe
Leon 0:694620b4c620 48 ,4,11,8,20,14,18,5,5,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //40 (
Leon 0:694620b4c620 49 ,4,-6,8,20,10,6,5,5,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //41 )
Leon 0:694620b4c620 50 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //42
Leon 0:694620b4c620 51 ,2,1,5,3,9,5,2,5,9,3,5,1,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //43 +
Leon 0:694620b4c620 52 ,2,3,1,3,1,-3,5,4,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //44 , virgule
Leon 0:694620b4c620 53 ,2,2,5,3,8,5,5,10,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //45 -
Leon 0:694620b4c620 54 ,6,2,1,5,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //46 . point
Leon 0:694620b4c620 55 ,2,9,15,3,1,1,5,10,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //47 /
Leon 0:694620b4c620 56 ,4,5,11,8,16,8,3,9,5,4,5,5,8,8,0,3,1,11,5,10 ,0,0,0,0,0,0,0,0,0,0 //48 0
Leon 0:694620b4c620 57 ,2,1,12,3,4,15,3,4,1,2,2,1,3,6,1,5,7,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //49 1
Leon 0:694620b4c620 58 ,4,5,11,8,16,6,3,1,1,3,9,1,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //50 2
Leon 0:694620b4c620 59 ,4,5,12,6,15,4,4,5,5,8,12,1,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //51 3
Leon 0:694620b4c620 60 ,2,9,7,3,1,7,3,7,15,3,7,1,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //52 4
Leon 0:694620b4c620 61 ,2,8,15,3,2,15,3,1,9,3,4,9,4,4,5,8,12,2,5,9 ,0,0,0,0,0,0,0,0,0,0 //53 5
Leon 0:694620b4c620 62 ,4,5,5,8,16,0,3,1,8,4,8,8,14,16,12,5,10,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //54 6
Leon 0:694620b4c620 63 ,2,1,15,3,9,15,3,1,1,5,10,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //55 7
Leon 0:694620b4c620 64 ,4,5,12,6,4,20,4,5,5,8,28,12,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //56 8
Leon 0:694620b4c620 65 ,4,5,11,8,24,8,3,9,8,4,2,8,14,8,4,5,10,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //57 9
Leon 0:694620b4c620 66 ,6,2,7,6,2,3,5,4,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //58 :
Leon 0:694620b4c620 67 ,6,3,7,2,3,1,3,1,-3,5,4,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //59 ;
Leon 0:694620b4c620 68 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //60 <
Leon 0:694620b4c620 69 ,2,2,7,3,8,7,2,2,3,3,8,3,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //61 =
Leon 0:694620b4c620 70 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //62 >
Leon 0:694620b4c620 71 ,4,5,11,8,16,8,4,7,11,4,8,4,4,7,7,4,12,16,3,5 ,4,6,5,1,5,10,0,0,0,0 //63 ?
Leon 0:694620b4c620 72 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //64
Leon 0:694620b4c620 73
Leon 0:694620b4c620 74 ,2,1,1,3,6,15,3,11,1,2,3,6,3,9,6,5,12,0,0,0,0,0,0,0,0,0,0,0,0,0 //A 65
Leon 0:694620b4c620 75 ,2,1,1,3,1,15,3,3,15,4,3,12,6,12,4,3,1,9,4,3,5,8,12,4,3,1,1,5,8,0 //B 66
Leon 0:694620b4c620 76 ,4,5,5,8,7,0,3,1,11,4,5,11,8,16,9,5,10,0,0,0,0,0,0,0,0,0,0,0,0,0 //C 67
Leon 0:694620b4c620 77 ,2,1,1,3,1,15,3,4,15,4,4,11,8,12,8,3,8,5,4,4,5,8,8,4,3,1,1,5,9,0 //D 68
Leon 0:694620b4c620 78 ,2,8,15,3,1,15,3,1,1,3,8,1,2,1,8,3,6,8,5,9 ,0,0,0,0,0,0,0,0,0,0 //E 69
Leon 0:694620b4c620 79 ,2,8,15,3,1,15,3,1,1,2,1,8,3,6,8,5,9,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //F 70
Leon 0:694620b4c620 80 ,4,5,11,8,9,16,3,1,5,4,5,5,8,0,8,3,9,8,3,5 ,8,5,10,0,0,0,0,0,0,0 //G 71
Leon 0:694620b4c620 81 ,2,1,15,3,1,1,2,1,8,3,8,8,2,8,15,3,8,1,5,9 ,0,0,0,0,0,0,0,0,0,0 //H 72
Leon 0:694620b4c620 82 ,2,1,15,3,5,15,2,3,15,3,3,1,2,1,1,3,5,1,5,6 ,0,0,0,0,0,0,0,0,0,0 //I 73
Leon 0:694620b4c620 83 ,4,4,4,6,0,8,3,7,15,2,5,15,3,9,15,5,10,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //J 74
Leon 0:694620b4c620 84 ,2,1,1,3,1,15,2,7,15,3,1,8,3,7,1,5,8,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //K 75
Leon 0:694620b4c620 85 ,2,1,15,3,1,1,3,8,1,5,9,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //L 76
Leon 0:694620b4c620 86 ,2,1,1,3,1,15,3,5,8,3,9,15,3,9,1,5,10,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //M 77
Leon 0:694620b4c620 87 ,2,1,1,3,1,15,3,9,1,3,9,15,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //N 78
Leon 0:694620b4c620 88 ,4,5,11,8,16,8,3,9,5,4,5,5,8,8,0,3,1,11,5,10 ,0,0,0,0,0,0,0,0,0,0 //O 79
Leon 0:694620b4c620 89 ,2,1,1,3,1,15,3,3,15,4,3,12,6,12,4,3,1,9,5,7 ,0,0,0,0,0,0,0,0,0,0 //P 80
Leon 0:694620b4c620 90 ,4,5,11,8,16,8,3,9,5,4,5,5,8,8,0,3,1,11,2,6,4,3,9,1,5,10,0,0,0,0 //Q 81
Leon 0:694620b4c620 91 ,2,1,1,3,1,15,3,3,15,4,3,12,6,12,4,3,1,9,2,3,9,3,6,1,5,7,0,0,0,0 //R 82
Leon 0:694620b4c620 92 ,4,5,11,8,8,16,3,9,5,4,5,5,8,8,0,5,10,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //S 83
Leon 0:694620b4c620 93 ,2,5,1,3,5,15,2,1,15,3,9,15,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //T 84
Leon 0:694620b4c620 94 ,2,1,15,3,1,5,4,5,5,8,0,8,3,9,15,5,10,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //U 85
Leon 0:694620b4c620 95 ,2,1,15,3,5,1,3,9,15,5,10,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //V 86
Leon 0:694620b4c620 96 ,2,1,15,3,5,1,3,7,8,3,9,1,3,13,15,5,14,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //W 87
Leon 0:694620b4c620 97 ,2,9,15,3,1,1,2,1,15,3,9,1,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //X 88
Leon 0:694620b4c620 98 ,2,9,15,3,1,1,2,1,15,3,5,8,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //Y 89
Leon 0:694620b4c620 99 ,2,1,15,3,9,15,3,1,1,3,9,1,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //Z 90
Leon 0:694620b4c620 100
Leon 0:694620b4c620 101 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //91
Leon 0:694620b4c620 102 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //92
Leon 0:694620b4c620 103 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //93
Leon 0:694620b4c620 104 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //94
Leon 0:694620b4c620 105 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //95
Leon 0:694620b4c620 106 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //96
Leon 0:694620b4c620 107
Leon 0:694620b4c620 108 ,4,4,4,6,8,24,3,7,7,4,4,7,6,8,15,5,8,0,0,0 ,0,0,0,0,0,0,0,0,0,0 // a 27
Leon 0:694620b4c620 109 ,4,5,5,8,0,16,2,1,1,3,1,15,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //b 28
Leon 0:694620b4c620 110 ,4,5,5,8,10,22,5,9,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //c 29
Leon 0:694620b4c620 111 ,4,5,5,8,24,8,2,9,1,3,9,15,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //d 30
Leon 0:694620b4c620 112 ,2,1,5,3,9,5,4,5,5,8,8,22,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //e 31
Leon 0:694620b4c620 113 ,2,1,1,3,1,10,4,4,10,6,16,10,2,4,7,3,1,7,5,7,0,0,0,0,0,0,0,0,0,0 //f 32
Leon 0:694620b4c620 114 ,4,5,5,8,24,8,3,9,0,4,5,0,8,8,1,5,10,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //g 33
Leon 0:694620b4c620 115 ,2,1,15,3,1,1,4,5,5,8,16,8,3,9,1,5,10,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //h 34
Leon 0:694620b4c620 116 ,2,2,1,3,2,9,6,2,12,5,4,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //i 35
Leon 0:694620b4c620 117 ,6,6,12,2,6,9,3,6,-1,4,3,-1,6,8,0,5,7,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //j 36
Leon 0:694620b4c620 118 ,2,1,15,3,1,1,2,6,9,3,1,5,3,6,1,5,7,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //k 37
Leon 0:694620b4c620 119 ,2,2,15,3,2,1,5,4,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //l 38
Leon 0:694620b4c620 120 ,2,1,9,3,1,1,4,4,6,6,16,8,3,7,1,4,10,6,6,16 ,8,3,13,1,5,14,0,0,0,0 //m 39
Leon 0:694620b4c620 121 ,2,1,9,3,1,1,4,5,5,8,16,8,3,9,1,5,10,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //n 40
Leon 0:694620b4c620 122 ,4,5,5,8,0,16,5,10,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //o 41
Leon 0:694620b4c620 123 ,2,1,-3,3,1,9,4,5,5,8,0,16,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //p 42
Leon 0:694620b4c620 124 ,4,5,5,8,0,16,2,9,9,3,9,-3,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //q 43
Leon 0:694620b4c620 125 ,2,1,9,3,1,1,4,5,5,8,16,9,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //r 44
Leon 0:694620b4c620 126 ,2,7,9,3,3,9,4,3,7,4,12,20,3,5,5,4,5,3,4,12 ,4,3,1,1,5,8,0,0,0,0 //s 45
Leon 0:694620b4c620 127 ,2,1,15,3,1,4,4,4,4,6,0,8,2,1,11,3,6,11,5,8 ,0,0,0,0,0,0,0,0,0,0 //t 46
Leon 0:694620b4c620 128 ,2,1,9,3,1,4,4,4,4,6,0,8,3,7,9,5,8,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //u 47
Leon 0:694620b4c620 129 ,2,1,9,3,5,1,3,9,9,5,10,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //v 48
Leon 0:694620b4c620 130 ,2,1,9,3,4,1,3,6,5,3,8,1,3,11,9,5,12,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //w 49
Leon 0:694620b4c620 131 ,2,7,9,3,1,1,2,1,9,3,7,1,5,8,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //x 50
Leon 0:694620b4c620 132 ,2,1,9,3,5,1,2,9,9,3,2,-5,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //y 121
Leon 0:694620b4c620 133 ,2,1,9,3,9,9,3,1,1,3,9,1,5,10,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //z 122
Leon 0:694620b4c620 134
Leon 0:694620b4c620 135 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //123
Leon 0:694620b4c620 136 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //124
Leon 0:694620b4c620 137 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //125
Leon 0:694620b4c620 138 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //126
Leon 0:694620b4c620 139 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //127
Leon 0:694620b4c620 140 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //128
Leon 0:694620b4c620 141 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //129
Leon 0:694620b4c620 142 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //130
Leon 0:694620b4c620 143 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //131
Leon 0:694620b4c620 144 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //132
Leon 0:694620b4c620 145 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //133
Leon 0:694620b4c620 146 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //134
Leon 0:694620b4c620 147 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //135
Leon 0:694620b4c620 148 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //136
Leon 0:694620b4c620 149 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //137
Leon 0:694620b4c620 150 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //138
Leon 0:694620b4c620 151 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //139
Leon 0:694620b4c620 152 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //140
Leon 0:694620b4c620 153 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //141
Leon 0:694620b4c620 154 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //142
Leon 0:694620b4c620 155 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //143
Leon 0:694620b4c620 156 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //144
Leon 0:694620b4c620 157 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //145
Leon 0:694620b4c620 158 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //146
Leon 0:694620b4c620 159 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //147
Leon 0:694620b4c620 160 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //148
Leon 0:694620b4c620 161 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //149
Leon 0:694620b4c620 162 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //150
Leon 0:694620b4c620 163 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //151
Leon 0:694620b4c620 164 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //152
Leon 0:694620b4c620 165 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //153
Leon 0:694620b4c620 166 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //154
Leon 0:694620b4c620 167 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //155
Leon 0:694620b4c620 168 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //156
Leon 0:694620b4c620 169 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //157
Leon 0:694620b4c620 170 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //158
Leon 0:694620b4c620 171 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //159
Leon 0:694620b4c620 172 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //160
Leon 0:694620b4c620 173 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //161
Leon 0:694620b4c620 174 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //162
Leon 0:694620b4c620 175 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //163
Leon 0:694620b4c620 176 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //164
Leon 0:694620b4c620 177 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //165
Leon 0:694620b4c620 178 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //166
Leon 0:694620b4c620 179 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //167
Leon 0:694620b4c620 180 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //168
Leon 0:694620b4c620 181 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //169
Leon 0:694620b4c620 182 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //170
Leon 0:694620b4c620 183 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //171
Leon 0:694620b4c620 184 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //172
Leon 0:694620b4c620 185 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //173
Leon 0:694620b4c620 186 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //174
Leon 0:694620b4c620 187 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //175
Leon 0:694620b4c620 188 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //176
Leon 0:694620b4c620 189 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //177 +/-
Leon 0:694620b4c620 190 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //178
Leon 0:694620b4c620 191 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //179
Leon 0:694620b4c620 192 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //180
Leon 0:694620b4c620 193 ,2,1,-3,3,1,9,4,4,4,6,0,8,3,7,9,5,8,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //181 µ
Leon 0:694620b4c620 194 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //182
Leon 0:694620b4c620 195 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //183
Leon 0:694620b4c620 196 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //184
Leon 0:694620b4c620 197 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //185
Leon 0:694620b4c620 198 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //186
Leon 0:694620b4c620 199 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //187
Leon 0:694620b4c620 200 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //188
Leon 0:694620b4c620 201 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //189
Leon 0:694620b4c620 202 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //190
Leon 0:694620b4c620 203 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //191
Leon 0:694620b4c620 204 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //192
Leon 0:694620b4c620 205 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //193
Leon 0:694620b4c620 206 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //194
Leon 0:694620b4c620 207 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //195
Leon 0:694620b4c620 208 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //196
Leon 0:694620b4c620 209 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //197
Leon 0:694620b4c620 210 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //198
Leon 0:694620b4c620 211 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //199
Leon 0:694620b4c620 212 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //200
Leon 0:694620b4c620 213 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //201
Leon 0:694620b4c620 214 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //202
Leon 0:694620b4c620 215 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //203
Leon 0:694620b4c620 216 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //204
Leon 0:694620b4c620 217 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //205
Leon 0:694620b4c620 218 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //206
Leon 0:694620b4c620 219 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //207
Leon 0:694620b4c620 220 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //208
Leon 0:694620b4c620 221 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //209
Leon 0:694620b4c620 222 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //210
Leon 0:694620b4c620 223 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //211
Leon 0:694620b4c620 224 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //212
Leon 0:694620b4c620 225 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //213
Leon 0:694620b4c620 226 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //214
Leon 0:694620b4c620 227 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //215
Leon 0:694620b4c620 228 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //216
Leon 0:694620b4c620 229 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //217
Leon 0:694620b4c620 230 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //218
Leon 0:694620b4c620 231 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //219
Leon 0:694620b4c620 232 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //220
Leon 0:694620b4c620 233 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //221
Leon 0:694620b4c620 234 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //222
Leon 0:694620b4c620 235 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //223
Leon 0:694620b4c620 236 ,4,4,4,6,8,24,3,7,7,4,4,7,6,8,15,2,2,14,3,6 ,12,5,8,0,0,0,0,0,0,0 //224 à
Leon 0:694620b4c620 237 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //225
Leon 0:694620b4c620 238 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //226
Leon 0:694620b4c620 239 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //227
Leon 0:694620b4c620 240 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //228
Leon 0:694620b4c620 241 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //229
Leon 0:694620b4c620 242 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //230
Leon 0:694620b4c620 243 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //231
Leon 0:694620b4c620 244 ,2,1,5,3,9,5,4,5,5,8,8,22,2,3,14,3,7,12,5,10 ,0,0,0,0,0,0,0,0,0,0 //232 è
Leon 0:694620b4c620 245 ,2,1,5,3,9,5,4,5,5,8,8,22,2,7,14,3,3,12,5,10 ,0,0,0,0,0,0,0,0,0,0 //233 é
Leon 0:694620b4c620 246 ,2,1,5,3,9,5,4,5,5,8,8,22,2,2,12,3,5,14,3,8 ,12,5,10,0,0,0,0,0,0,0//234 ê
Leon 0:694620b4c620 247 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //235
Leon 0:694620b4c620 248 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //236
Leon 0:694620b4c620 249 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //237
Leon 0:694620b4c620 250 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //238
Leon 0:694620b4c620 251 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //239 ï
Leon 0:694620b4c620 252 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //240
Leon 0:694620b4c620 253 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //241
Leon 0:694620b4c620 254 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //242
Leon 0:694620b4c620 255 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //243
Leon 0:694620b4c620 256 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //244 ô
Leon 0:694620b4c620 257 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //245
Leon 0:694620b4c620 258 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //246 ö
Leon 0:694620b4c620 259 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //247
Leon 0:694620b4c620 260 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //248
Leon 0:694620b4c620 261 ,2,1,9,3,1,4,4,4,4,6,0,8,3,7,9,2,2,14,3,6,12,5,8,0,0,0,0,0,0,0 //249 ù
Leon 0:694620b4c620 262 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //250
Leon 0:694620b4c620 263 ,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0,0,0 //251
Leon 0:694620b4c620 264 };
Leon 0:694620b4c620 265
Leon 0:694620b4c620 266 void stop_tick_servo(void)
Leon 0:694620b4c620 267 {
Leon 0:694620b4c620 268 servoout=0;
Leon 0:694620b4c620 269 }
Leon 0:694620b4c620 270
Leon 0:694620b4c620 271 void tick_servo (void)
Leon 0:694620b4c620 272 {
Leon 0:694620b4c620 273 servoout=1;
Leon 0:694620b4c620 274 servo_timeout.attach_us(&stop_tick_servo, cons_servo_main);
Leon 0:694620b4c620 275 }
Leon 0:694620b4c620 276
Leon 0:694620b4c620 277 void clk_stepper1(void)
Leon 0:694620b4c620 278 {
Leon 0:694620b4c620 279 stepper_clk_1=1;
Leon 0:694620b4c620 280 pulse_stepper1.attach_us(&clk_stepper1, period_stepper1);
Leon 0:694620b4c620 281 a_coude=a_coude + dir_1_real;
Leon 0:694620b4c620 282 stepper_clk_1=0;
Leon 0:694620b4c620 283 }
Leon 0:694620b4c620 284
Leon 0:694620b4c620 285 void clk_stepper2(void)
Leon 0:694620b4c620 286 {
Leon 0:694620b4c620 287 stepper_clk_2=1;
Leon 0:694620b4c620 288 pulse_stepper2.attach_us(&clk_stepper2, period_stepper2);
Leon 0:694620b4c620 289 a_epaule=a_epaule + dir_2_real;
Leon 0:694620b4c620 290 stepper_clk_2=0;
Leon 0:694620b4c620 291 }
Leon 0:694620b4c620 292
Leon 0:694620b4c620 293 void tick_detach()
Leon 0:694620b4c620 294 {
Leon 0:694620b4c620 295 tick_attached_coude=0;
Leon 0:694620b4c620 296 tick_attached_epaule=0;
Leon 0:694620b4c620 297 pulse_stepper1.detach();
Leon 0:694620b4c620 298 pulse_stepper2.detach();
Leon 0:694620b4c620 299 }
Leon 0:694620b4c620 300
Leon 0:694620b4c620 301 void set_poignet(int pospoignet)
Leon 0:694620b4c620 302 {
Leon 0:694620b4c620 303 switch (pospoignet) {
Leon 0:694620b4c620 304 case 1 : //stylo pose
Leon 0:694620b4c620 305 if (cons_servo_main!=servo_stylo_pos) {
Leon 0:694620b4c620 306 wait_ms(100);
Leon 0:694620b4c620 307 cons_servo_main=servo_stylo_pos;
Leon 0:694620b4c620 308 myled=1;
Leon 0:694620b4c620 309 wait_ms(80);
Leon 0:694620b4c620 310 }
Leon 0:694620b4c620 311 precis=1;
Leon 0:694620b4c620 312 break;
Leon 0:694620b4c620 313 case 2 : //stylo leve
Leon 0:694620b4c620 314 if (cons_servo_main!=servo_stylo_lev) {
Leon 0:694620b4c620 315 //wait_ms(50);
Leon 0:694620b4c620 316 cons_servo_main=servo_stylo_lev;
Leon 0:694620b4c620 317 myled=0;
Leon 0:694620b4c620 318 wait_ms(50);
Leon 0:694620b4c620 319 }
Leon 0:694620b4c620 320 precis=0;
Leon 0:694620b4c620 321 break;
Leon 0:694620b4c620 322 case 3 : //neutre
Leon 0:694620b4c620 323 cons_servo_main=servo_neutre;
Leon 0:694620b4c620 324 precis=0;
Leon 0:694620b4c620 325 break;
Leon 0:694620b4c620 326 case 4 : //gomme levee
Leon 0:694620b4c620 327 cons_servo_main=servo_gomme_lev;
Leon 0:694620b4c620 328 precis=0;
Leon 0:694620b4c620 329 break;
Leon 0:694620b4c620 330 case 5 : //gomme posee
Leon 0:694620b4c620 331 cons_servo_main=servo_gomme_pos;
Leon 0:694620b4c620 332 precis=2;
Leon 0:694620b4c620 333 }
Leon 0:694620b4c620 334 }
Leon 0:694620b4c620 335
Leon 0:694620b4c620 336
Leon 0:694620b4c620 337
Leon 0:694620b4c620 338 void init_stepper()
Leon 0:694620b4c620 339 {
Leon 0:694620b4c620 340 //int arret=0;
Leon 0:694620b4c620 341 int i;
Leon 0:694620b4c620 342 while (switch_epaule==1) {
Leon 0:694620b4c620 343 stepper_clk_2=1;
Leon 0:694620b4c620 344 wait_us(10);
Leon 0:694620b4c620 345 stepper_clk_2=0;
Leon 0:694620b4c620 346 wait_ms(3);
Leon 0:694620b4c620 347 }
Leon 0:694620b4c620 348 stepper_dir_2=1;
Leon 0:694620b4c620 349 for (i=1; i<2620; i++) { //2640
Leon 0:694620b4c620 350 stepper_clk_2=1;
Leon 0:694620b4c620 351 wait_us(10);
Leon 0:694620b4c620 352 stepper_clk_2=0;
Leon 0:694620b4c620 353 wait_ms(1);
Leon 0:694620b4c620 354 }
Leon 0:694620b4c620 355 while (switch_coude==1) {
Leon 0:694620b4c620 356 stepper_clk_1=1;
Leon 0:694620b4c620 357 wait_us(10);
Leon 0:694620b4c620 358 stepper_clk_1=0;
Leon 0:694620b4c620 359 wait_ms(3);
Leon 0:694620b4c620 360 }
Leon 0:694620b4c620 361 a_coude=-2940;//2900
Leon 0:694620b4c620 362 a_epaule=0;
Leon 0:694620b4c620 363 //stepper_dir_1=1;
Leon 0:694620b4c620 364 // for (i=1;i<2900;i++) {
Leon 0:694620b4c620 365 // stepper_clk_1=1;
Leon 0:694620b4c620 366 // wait_us(10);
Leon 0:694620b4c620 367 // stepper_clk_1=0;
Leon 0:694620b4c620 368 // wait_ms(1);
Leon 0:694620b4c620 369 //}
Leon 0:694620b4c620 370 //cons_servo_main=1800;
Leon 0:694620b4c620 371 }
Leon 0:694620b4c620 372
Leon 0:694620b4c620 373 void setpos_ang (int a_coude_cible, int a_epaule_cible, int delay_ms)
Leon 0:694620b4c620 374 {
Leon 0:694620b4c620 375 int err_a_coude, err_a_epaule;
Leon 0:694620b4c620 376 float delay_1, delay_2;
Leon 0:694620b4c620 377 //pulse_stepper1.detach();
Leon 0:694620b4c620 378 //pulse_stepper2.detach();
Leon 0:694620b4c620 379 err_a_coude=a_coude_cible - a_coude;
Leon 0:694620b4c620 380 err_a_epaule=a_epaule_cible - a_epaule;
Leon 0:694620b4c620 381 if (err_a_coude>0) {
Leon 0:694620b4c620 382 stepper_dir_1=1;
Leon 0:694620b4c620 383 dir_1_real=1;
Leon 0:694620b4c620 384 } else {
Leon 0:694620b4c620 385 stepper_dir_1=0;
Leon 0:694620b4c620 386 dir_1_real=-1;
Leon 0:694620b4c620 387 };
Leon 0:694620b4c620 388 if (err_a_epaule>0) {
Leon 0:694620b4c620 389 stepper_dir_2=1;
Leon 0:694620b4c620 390 dir_2_real=1;
Leon 0:694620b4c620 391 } else {
Leon 0:694620b4c620 392 stepper_dir_2=0;
Leon 0:694620b4c620 393 dir_2_real=-1;
Leon 0:694620b4c620 394 };
Leon 0:694620b4c620 395 err_a_coude=abs(err_a_coude);
Leon 0:694620b4c620 396 err_a_epaule=abs(err_a_epaule);
Leon 0:694620b4c620 397 //pc.printf("err
Leon 0:694620b4c620 398 if (err_a_coude !=0) { //laisser imperativement !=0
Leon 0:694620b4c620 399 delay_1=delay_ms*1000/err_a_coude;
Leon 0:694620b4c620 400 //printf("delay1 : %f\r\n",delay_1);
Leon 0:694620b4c620 401 if (delay_1<250) {
Leon 0:694620b4c620 402 pc.printf("X:%f Y:%f\r\n",X_pos, Y_pos);
Leon 0:694620b4c620 403 printf("delay1 : %f\r\n",delay_1);
Leon 0:694620b4c620 404 printf("a_coude:%d a_coude_cible: %d err_coude : %d\r\n\r\n",a_coude, a_coude_cible, err_a_coude);
Leon 0:694620b4c620 405
Leon 0:694620b4c620 406 delay_1=250;
Leon 0:694620b4c620 407 led_err=1;
Leon 0:694620b4c620 408 //wait(1);
Leon 0:694620b4c620 409 led_err=0;
Leon 0:694620b4c620 410 }
Leon 0:694620b4c620 411 period_stepper1=delay_1-3;
Leon 0:694620b4c620 412 if (tick_attached_coude==0) {
Leon 0:694620b4c620 413 pulse_stepper1.attach_us(&clk_stepper1, period_stepper1);
Leon 0:694620b4c620 414 tick_attached_coude=1;
Leon 0:694620b4c620 415 }
Leon 0:694620b4c620 416 } else {
Leon 0:694620b4c620 417 tick_attached_coude=0;
Leon 0:694620b4c620 418 pulse_stepper1.detach();
Leon 0:694620b4c620 419 }
Leon 0:694620b4c620 420
Leon 0:694620b4c620 421 if (err_a_epaule!=0) { //laisser imperativement !=0
Leon 0:694620b4c620 422 delay_2=delay_ms*1000/err_a_epaule;
Leon 0:694620b4c620 423 //printf("delay2 : %f\r\n",delay_2);
Leon 0:694620b4c620 424 if (delay_2<250) {
Leon 0:694620b4c620 425 pc.printf("X:%f Y:%f\r\n",X_pos, Y_pos);
Leon 0:694620b4c620 426 printf("delay2 : %f\r\n",delay_2);
Leon 0:694620b4c620 427 printf("a_epaule:%d a_epaule_cible:%d err_epaul : %d\r\n\r\n",a_epaule, a_epaule_cible, err_a_epaule);
Leon 0:694620b4c620 428 delay_2=250;
Leon 0:694620b4c620 429 led_err=1;
Leon 0:694620b4c620 430 //wait(1);
Leon 0:694620b4c620 431 led_err=0;
Leon 0:694620b4c620 432 }
Leon 0:694620b4c620 433 period_stepper2=delay_2-3;
Leon 0:694620b4c620 434 if (tick_attached_epaule==0) {
Leon 0:694620b4c620 435 pulse_stepper2.attach_us(&clk_stepper2, period_stepper2);
Leon 0:694620b4c620 436 tick_attached_epaule=1;
Leon 0:694620b4c620 437 }
Leon 0:694620b4c620 438 } else {
Leon 0:694620b4c620 439 tick_attached_epaule=0;
Leon 0:694620b4c620 440 pulse_stepper2.detach();
Leon 0:694620b4c620 441 }
Leon 0:694620b4c620 442 //tick_attached=1;
Leon 0:694620b4c620 443 wait_ms(delay_ms);
Leon 0:694620b4c620 444 //pulse_stepper1.detach();
Leon 0:694620b4c620 445 //pulse_stepper2.detach();
Leon 0:694620b4c620 446 //pc.printf("Reelles coude: %d ; epaule: %d\r\n\r\n", a_coude, a_epaule);
Leon 0:694620b4c620 447 }
Leon 0:694620b4c620 448
Leon 0:694620b4c620 449 void goto_2D_short (float X_cible, float Y_cible, int delay_ms)
Leon 0:694620b4c620 450 {
Leon 0:694620b4c620 451 float allonge, deltax, deltay, alpha_D, arad_coude_cible, arad_epaule_cible, consigne_coude, consigne_epaule, erreur_coude, erreur_epaule;
Leon 0:694620b4c620 452 int delay_loc;
Leon 0:694620b4c620 453 // inversion matrice simplifiee
Leon 0:694620b4c620 454 if (X_cible > 360) {
Leon 0:694620b4c620 455 X_cible=360;
Leon 0:694620b4c620 456 }
Leon 0:694620b4c620 457 if (X_cible < 0) {
Leon 0:694620b4c620 458 X_cible=0;
Leon 0:694620b4c620 459 }
Leon 0:694620b4c620 460 if (Y_cible > 145) {
Leon 0:694620b4c620 461 Y_cible=145; //110
Leon 0:694620b4c620 462 }
Leon 0:694620b4c620 463 if (Y_cible < 0) {
Leon 0:694620b4c620 464 Y_cible=0;
Leon 0:694620b4c620 465 }
Leon 0:694620b4c620 466 deltax=X_cible-180;
Leon 0:694620b4c620 467 deltay=235-Y_cible;//220
Leon 0:694620b4c620 468 allonge=sqrt((deltax*deltax)+(deltay*deltay));
Leon 0:694620b4c620 469 arad_coude_cible=2*acos(allonge/320);// inverser le signe quand passage a consigne
Leon 0:694620b4c620 470 alpha_D=atan(deltax/deltay);
Leon 0:694620b4c620 471
Leon 0:694620b4c620 472 //conversion en consigne brutes (pas)
Leon 0:694620b4c620 473 if (outil==0) { //stylo
Leon 0:694620b4c620 474 arad_epaule_cible=alpha_D+(arad_coude_cible/2);
Leon 0:694620b4c620 475 consigne_epaule = arad_epaule_cible*1120.5;
Leon 0:694620b4c620 476 consigne_coude = consigne_epaule/4.4 -arad_coude_cible*1120.5;
Leon 0:694620b4c620 477 } else {
Leon 0:694620b4c620 478 arad_epaule_cible=alpha_D-(arad_coude_cible/2); //gomme
Leon 0:694620b4c620 479 consigne_epaule = arad_epaule_cible*1120.5;
Leon 0:694620b4c620 480 consigne_coude = consigne_epaule/4.4 +arad_coude_cible*1120.5-850;
Leon 0:694620b4c620 481 }
Leon 0:694620b4c620 482
Leon 0:694620b4c620 483 //pc.printf("consigne_coude:%d ; epaule:%d\r\n", (int)consigne_coude, (int)consigne_epaule);
Leon 0:694620b4c620 484 //pc.printf("X:%f Y:%f\r\n", X_cible, Y_cible);
Leon 0:694620b4c620 485
Leon 0:694620b4c620 486 if (delay_ms==0) {
Leon 0:694620b4c620 487 erreur_coude=abs(consigne_coude-a_coude);
Leon 0:694620b4c620 488 erreur_epaule=abs(consigne_epaule-a_epaule);
Leon 0:694620b4c620 489 //delay_loc=0.5*max(erreur_coude, erreur_epaule);
Leon 0:694620b4c620 490 if (erreur_coude>erreur_epaule) {
Leon 0:694620b4c620 491 delay_loc=0.75*erreur_coude;
Leon 0:694620b4c620 492 } else {
Leon 0:694620b4c620 493 delay_loc=0.75*erreur_epaule;
Leon 0:694620b4c620 494 }
Leon 0:694620b4c620 495 setpos_ang (consigne_coude, consigne_epaule, delay_loc);
Leon 0:694620b4c620 496 X_pos=X_cible;
Leon 0:694620b4c620 497 Y_pos=Y_cible;
Leon 0:694620b4c620 498 } else {
Leon 0:694620b4c620 499 setpos_ang (consigne_coude, consigne_epaule, delay_ms);
Leon 0:694620b4c620 500 X_pos=X_cible;
Leon 0:694620b4c620 501 Y_pos=Y_cible;
Leon 0:694620b4c620 502 //cinematique directe:
Leon 0:694620b4c620 503 }
Leon 0:694620b4c620 504 }
Leon 0:694620b4c620 505
Leon 0:694620b4c620 506 void goto_2D_line (float X_cible, float Y_cible)
Leon 0:694620b4c620 507 {
Leon 0:694620b4c620 508 float delta_x, delta_y, distance, x_decomp, y_decomp;
Leon 0:694620b4c620 509 int nb_pas, i;
Leon 0:694620b4c620 510 delta_x=X_cible-X_pos;
Leon 0:694620b4c620 511 delta_y=Y_cible-Y_pos;
Leon 0:694620b4c620 512 distance=sqrt((delta_x*delta_x)+(delta_y*delta_y));
Leon 0:694620b4c620 513 nb_pas = ceil (distance*1);// 1 pas = 1mm donc pas de facteur
Leon 0:694620b4c620 514 //pc.printf ("nb pas: %i\r\n", nb_pas);
Leon 0:694620b4c620 515 delta_x=delta_x/nb_pas;
Leon 0:694620b4c620 516 delta_y=delta_y/nb_pas;
Leon 0:694620b4c620 517 x_decomp=X_pos;
Leon 0:694620b4c620 518 y_decomp=Y_pos;
Leon 0:694620b4c620 519 //tick_detach();
Leon 0:694620b4c620 520 for (i=1; i<=nb_pas; i++) {
Leon 0:694620b4c620 521 x_decomp=x_decomp+delta_x;
Leon 0:694620b4c620 522 y_decomp=y_decomp+delta_y;
Leon 0:694620b4c620 523 //pc.printf ("decomp: X: %f Y: %f\r\n", x_decomp, y_decomp);
Leon 0:694620b4c620 524 if(precis==1) {
Leon 0:694620b4c620 525 goto_2D_short (x_decomp, y_decomp, 10+70*potard_1.read()); //12
Leon 0:694620b4c620 526 } else if (precis==2) {
Leon 0:694620b4c620 527 goto_2D_short (x_decomp, y_decomp,13);
Leon 0:694620b4c620 528 } else {
Leon 0:694620b4c620 529 goto_2D_short (x_decomp, y_decomp, 9);
Leon 0:694620b4c620 530 }
Leon 0:694620b4c620 531 }
Leon 0:694620b4c620 532 tick_detach();
Leon 0:694620b4c620 533 }
Leon 0:694620b4c620 534
Leon 0:694620b4c620 535 void circle_2D(float X_centre, float Y_centre, float rayon, float angle_deb, float angle_fin)
Leon 0:694620b4c620 536 {
Leon 0:694620b4c620 537 float pas_angle, angle_actuel, x_decomp, y_decomp, delta_x, delta_y, distance;
Leon 0:694620b4c620 538 int nb_pas, i;
Leon 0:694620b4c620 539 nb_pas=1*ceil (rayon * abs (angle_fin-angle_deb));
Leon 0:694620b4c620 540 pas_angle=(angle_fin-angle_deb)/nb_pas;
Leon 0:694620b4c620 541 angle_actuel=angle_deb;
Leon 0:694620b4c620 542 x_decomp=X_centre + rayon*cos (angle_actuel);
Leon 0:694620b4c620 543 y_decomp=Y_centre + rayon*sin (angle_actuel);
Leon 0:694620b4c620 544 delta_x=x_decomp-X_pos;
Leon 0:694620b4c620 545 delta_y=y_decomp-Y_pos;
Leon 0:694620b4c620 546 distance=sqrt((delta_x*delta_x)+(delta_y*delta_y));
Leon 0:694620b4c620 547 //pc.printf("decomp circle : X:%f Y:%f\r\n", x_decomp, y_decomp);
Leon 0:694620b4c620 548 //tick_detach();
Leon 0:694620b4c620 549 if (distance>2) {
Leon 0:694620b4c620 550 //cons_servo_main=servo_stylo_lev;
Leon 0:694620b4c620 551 set_poignet(2);
Leon 0:694620b4c620 552 //wait_ms(100);
Leon 0:694620b4c620 553 goto_2D_line (x_decomp, y_decomp);
Leon 0:694620b4c620 554 }
Leon 0:694620b4c620 555 set_poignet(1);
Leon 0:694620b4c620 556 //if (cons_servo_main!=servo_stylo_pos) {
Leon 0:694620b4c620 557 // //cons_servo_main=servo_stylo_pos;
Leon 0:694620b4c620 558 // set_poignet(1);
Leon 0:694620b4c620 559 // //wait_ms(100);
Leon 0:694620b4c620 560 // }
Leon 0:694620b4c620 561 //tick_detach();
Leon 0:694620b4c620 562 for (i=1; i<=nb_pas; i++) {
Leon 0:694620b4c620 563 angle_actuel=angle_actuel+pas_angle;
Leon 0:694620b4c620 564 x_decomp=X_centre + rayon*cos (angle_actuel);
Leon 0:694620b4c620 565 y_decomp=Y_centre + rayon*sin (angle_actuel);
Leon 0:694620b4c620 566 //pc.printf("decomp circle : X:%f Y:%f\r\n", x_decomp, y_decomp);
Leon 0:694620b4c620 567 goto_2D_short (x_decomp, y_decomp, 10+70*potard_1.read());
Leon 0:694620b4c620 568 }
Leon 0:694620b4c620 569 tick_detach();
Leon 0:694620b4c620 570 }
Leon 0:694620b4c620 571
Leon 0:694620b4c620 572 void set_outil(int outil_loc, float X_loc, float Y_loc)
Leon 0:694620b4c620 573 {
Leon 0:694620b4c620 574 if ((outil_loc==1)&&(outil==0)) {//gomme
Leon 0:694620b4c620 575 set_poignet(3);
Leon 0:694620b4c620 576 outil=1;
Leon 0:694620b4c620 577 goto_2D_short (X_loc, Y_loc,0);//2000
Leon 0:694620b4c620 578 tick_detach();
Leon 0:694620b4c620 579 set_poignet(4);
Leon 0:694620b4c620 580 wait_ms(200);
Leon 0:694620b4c620 581 } else if ((outil_loc==0)&&(outil==1)) {
Leon 0:694620b4c620 582 set_poignet(3);
Leon 0:694620b4c620 583 outil=0;
Leon 0:694620b4c620 584 goto_2D_short (X_loc, Y_loc,0);//2000
Leon 0:694620b4c620 585 tick_detach();
Leon 0:694620b4c620 586 set_poignet(2);
Leon 0:694620b4c620 587 wait_ms(200);
Leon 0:694620b4c620 588 } else if ((outil_loc==1)&&(outil==1)) {
Leon 0:694620b4c620 589 set_poignet(4);
Leon 0:694620b4c620 590 }
Leon 0:694620b4c620 591 }
Leon 0:694620b4c620 592
Leon 0:694620b4c620 593 void print_lettre(char lettre, float taille)
Leon 0:694620b4c620 594 {
Leon 0:694620b4c620 595 int fin_lettre=0;
Leon 0:694620b4c620 596 int i_instr=0;
Leon 0:694620b4c620 597 int x_temp, y_temp, lettre_loc;
Leon 0:694620b4c620 598 float X_local, Y_local;
Leon 0:694620b4c620 599 float rayon_loc, angle_deb_loc, angle_fin_loc;
Leon 0:694620b4c620 600 lettre_loc=lettre;
Leon 0:694620b4c620 601 //printf ("char: %d", lettre+32);
Leon 0:694620b4c620 602 if (lettre_loc<0) {
Leon 0:694620b4c620 603 lettre_loc=lettre+256;
Leon 0:694620b4c620 604 }
Leon 0:694620b4c620 605 //printf ("char: %d\r\n", lettre_loc+32);
Leon 0:694620b4c620 606 set_outil(0,X_print,Y_print);
Leon 0:694620b4c620 607 while (fin_lettre==0) {
Leon 0:694620b4c620 608 switch (police_maj[lettre_loc][i_instr]) {
Leon 0:694620b4c620 609 case 2 : // aller stylo leve
Leon 0:694620b4c620 610 //cons_servo_main=servo_stylo_lev;
Leon 0:694620b4c620 611 set_poignet(2);
Leon 0:694620b4c620 612 //wait_ms(100);
Leon 0:694620b4c620 613 X_local=X_print+taille*(police_maj[lettre_loc][i_instr+1]);
Leon 0:694620b4c620 614 y_temp=police_maj[lettre_loc][i_instr+2];
Leon 0:694620b4c620 615 if (y_temp>127) {
Leon 0:694620b4c620 616 y_temp=y_temp-256;
Leon 0:694620b4c620 617 }
Leon 0:694620b4c620 618 Y_local=Y_print+taille*y_temp;
Leon 0:694620b4c620 619 goto_2D_line(X_local, Y_local);
Leon 0:694620b4c620 620 i_instr=i_instr+3;
Leon 0:694620b4c620 621 break;
Leon 0:694620b4c620 622 case 3 : // ligne stylo pose
Leon 0:694620b4c620 623 set_poignet(1);
Leon 0:694620b4c620 624 //if (cons_servo_main!=servo_stylo_pos) {
Leon 0:694620b4c620 625 // cons_servo_main=servo_stylo_pos;
Leon 0:694620b4c620 626 // wait_ms(100);
Leon 0:694620b4c620 627 //}
Leon 0:694620b4c620 628 X_local=X_print+taille*(police_maj[lettre_loc][i_instr+1]);
Leon 0:694620b4c620 629 y_temp=police_maj[lettre_loc][i_instr+2];
Leon 0:694620b4c620 630 if (y_temp>127) {
Leon 0:694620b4c620 631 y_temp=y_temp-256;
Leon 0:694620b4c620 632 }
Leon 0:694620b4c620 633 Y_local=Y_print+taille*y_temp;
Leon 0:694620b4c620 634 goto_2D_line(X_local, Y_local);
Leon 0:694620b4c620 635 i_instr=i_instr+3;
Leon 0:694620b4c620 636 break;
Leon 0:694620b4c620 637 case 4 : // cercle
Leon 0:694620b4c620 638 //X_local=X_print+taille*(police_maj[lettre_loc][i_instr+1]);
Leon 0:694620b4c620 639 x_temp=police_maj[lettre_loc][i_instr+1];
Leon 0:694620b4c620 640 if (x_temp>127) {
Leon 0:694620b4c620 641 x_temp=x_temp-256;
Leon 0:694620b4c620 642 }
Leon 0:694620b4c620 643 X_local=X_print+taille*x_temp;
Leon 0:694620b4c620 644 y_temp=police_maj[lettre_loc][i_instr+2];
Leon 0:694620b4c620 645 if (y_temp>127) {
Leon 0:694620b4c620 646 y_temp=y_temp-256;
Leon 0:694620b4c620 647 }
Leon 0:694620b4c620 648 Y_local=Y_print+taille*y_temp;
Leon 0:694620b4c620 649 rayon_loc=taille*(police_maj[lettre_loc][i_instr+3])/2;
Leon 0:694620b4c620 650 angle_deb_loc=(0.3927*police_maj[lettre_loc][i_instr+4])-3.1416;
Leon 0:694620b4c620 651 angle_fin_loc=(0.3927*police_maj[lettre_loc][i_instr+5])-3.1416;
Leon 0:694620b4c620 652 //pc.printf("angles: %f %f \r\n", angle_deb_loc, angle_fin_loc);
Leon 0:694620b4c620 653 circle_2D(X_local, Y_local, rayon_loc, angle_deb_loc, angle_fin_loc);
Leon 0:694620b4c620 654 i_instr=i_instr+6;
Leon 0:694620b4c620 655 break;
Leon 0:694620b4c620 656 case 5 : // fin
Leon 0:694620b4c620 657 fin_lettre=1;
Leon 0:694620b4c620 658 X_print=X_print+taille*(police_maj[lettre_loc][i_instr+1]);
Leon 0:694620b4c620 659 //cons_servo_main=servo_stylo_lev;
Leon 0:694620b4c620 660 set_poignet(2);
Leon 0:694620b4c620 661 //wait_ms(50);
Leon 0:694620b4c620 662 break;
Leon 0:694620b4c620 663 case 6 : // point
Leon 0:694620b4c620 664 X_local=X_print+taille*(police_maj[lettre_loc][i_instr+1]);
Leon 0:694620b4c620 665 Y_local=Y_print+taille*(police_maj[lettre_loc][i_instr+2]);
Leon 0:694620b4c620 666 set_poignet(2);
Leon 0:694620b4c620 667 goto_2D_line(X_local, Y_local);
Leon 0:694620b4c620 668 set_poignet(1);
Leon 0:694620b4c620 669 goto_2D_line(X_local, Y_local);
Leon 0:694620b4c620 670 set_poignet(2);
Leon 0:694620b4c620 671 i_instr=i_instr+3;
Leon 0:694620b4c620 672 break;
Leon 0:694620b4c620 673 }
Leon 0:694620b4c620 674 }
Leon 0:694620b4c620 675 }
Leon 0:694620b4c620 676
Leon 0:694620b4c620 677 void print_lettre_fictif(char lettre, float taille)
Leon 0:694620b4c620 678 {
Leon 0:694620b4c620 679 int fin_lettre=0;
Leon 0:694620b4c620 680 int i_instr=0;
Leon 0:694620b4c620 681 int x_temp, y_temp, lettre_loc;
Leon 0:694620b4c620 682 float X_local, Y_local;
Leon 0:694620b4c620 683 float rayon_loc, angle_deb_loc, angle_fin_loc;
Leon 0:694620b4c620 684 lettre_loc=lettre;
Leon 0:694620b4c620 685 //printf ("char: %d", lettre+32);
Leon 0:694620b4c620 686 if (lettre_loc<0) {
Leon 0:694620b4c620 687 lettre_loc=lettre+256;
Leon 0:694620b4c620 688 }
Leon 0:694620b4c620 689 //printf ("char fictif: %d\r\n", lettre_loc+32);
Leon 0:694620b4c620 690 while (fin_lettre==0) {
Leon 0:694620b4c620 691 switch (police_maj[lettre_loc][i_instr]) {
Leon 0:694620b4c620 692 case 2 : // aller stylo leve
Leon 0:694620b4c620 693 i_instr=i_instr+3;
Leon 0:694620b4c620 694 break;
Leon 0:694620b4c620 695 case 3 : // ligne stylo pose
Leon 0:694620b4c620 696 i_instr=i_instr+3;
Leon 0:694620b4c620 697 break;
Leon 0:694620b4c620 698 case 4 : // cercle
Leon 0:694620b4c620 699 i_instr=i_instr+6;
Leon 0:694620b4c620 700 break;
Leon 0:694620b4c620 701 case 5 : // fin
Leon 0:694620b4c620 702 fin_lettre=1;
Leon 0:694620b4c620 703 X_fictif=X_fictif+taille*(police_maj[lettre_loc][i_instr+1]);
Leon 0:694620b4c620 704 break;
Leon 0:694620b4c620 705 case 6 : // point
Leon 0:694620b4c620 706 i_instr=i_instr+3;
Leon 0:694620b4c620 707 break;
Leon 0:694620b4c620 708 }
Leon 0:694620b4c620 709 }
Leon 0:694620b4c620 710 }
Leon 0:694620b4c620 711
Leon 0:694620b4c620 712 void efface(float Xl1, float Yl1, float Xl2, float Yl2)
Leon 0:694620b4c620 713 {
Leon 0:694620b4c620 714 float distance_Y,pas, Y_loc;
Leon 0:694620b4c620 715 int i, nb_pas, outil_old_loc;
Leon 0:694620b4c620 716 outil_old_loc=outil;
Leon 0:694620b4c620 717 set_outil(1, Xl1, Yl1);
Leon 0:694620b4c620 718 goto_2D_line(Xl1,Yl1);
Leon 0:694620b4c620 719 set_poignet(5);
Leon 0:694620b4c620 720 distance_Y=Yl2-Yl1;
Leon 0:694620b4c620 721 //nb_pas=ceil(distance_Y/5);
Leon 0:694620b4c620 722 //pas=distance_Y/nb_pas;
Leon 0:694620b4c620 723 Y_loc=Yl1;
Leon 0:694620b4c620 724 //for (i=0;i<=nb_pas;i++)
Leon 0:694620b4c620 725 while (Y_loc<Yl2) {
Leon 0:694620b4c620 726 goto_2D_line(Xl1, Y_loc);
Leon 0:694620b4c620 727 goto_2D_line(Xl2, Y_loc);
Leon 0:694620b4c620 728 Y_loc=Y_loc+5;
Leon 0:694620b4c620 729 goto_2D_line(Xl2, Y_loc);
Leon 0:694620b4c620 730 goto_2D_line(Xl1, Y_loc);
Leon 0:694620b4c620 731 Y_loc=Y_loc+5;
Leon 0:694620b4c620 732 }
Leon 0:694620b4c620 733 set_poignet(4);
Leon 0:694620b4c620 734 //set_outil(outil_old_loc);
Leon 0:694620b4c620 735 }
Leon 0:694620b4c620 736
Leon 0:694620b4c620 737
Leon 0:694620b4c620 738 void print_heure(void)
Leon 0:694620b4c620 739 {
Leon 0:694620b4c620 740 char texte_heure[10];
Leon 0:694620b4c620 741 char texte_minute[10];
Leon 0:694620b4c620 742 int outil_bk,precis_bk, difference;
Leon 0:694620b4c620 743 int cons_servo_main_bk;
Leon 0:694620b4c620 744 float X_backup, Y_backup,X_pos_bk, Y_pos_bk;
Leon 0:694620b4c620 745 struct tm * timeinfo;
Leon 0:694620b4c620 746 time_t seconds = time(NULL);
Leon 0:694620b4c620 747 timeinfo = localtime (&seconds);
Leon 0:694620b4c620 748 strftime(texte_heure,10,"%H",timeinfo);
Leon 0:694620b4c620 749 strftime(texte_minute,10,"%M",timeinfo);
Leon 0:694620b4c620 750 X_backup=X_print;
Leon 0:694620b4c620 751 Y_backup=Y_print;
Leon 0:694620b4c620 752 X_pos_bk=X_pos;
Leon 0:694620b4c620 753 Y_pos_bk=Y_pos;
Leon 0:694620b4c620 754 outil_bk=outil;
Leon 0:694620b4c620 755 precis_bk=precis;
Leon 0:694620b4c620 756 difference=0;
Leon 0:694620b4c620 757 cons_servo_main_bk=cons_servo_main;
Leon 0:694620b4c620 758 if (strcmp(texte_minute, texte_minute_bk)!=0) {
Leon 0:694620b4c620 759 efface(325,107,359,138);
Leon 0:694620b4c620 760 X_print=330;
Leon 0:694620b4c620 761 Y_print=110;
Leon 0:694620b4c620 762 print_lettre(texte_minute[0]-32,taille_glob);
Leon 0:694620b4c620 763 X_print=345;
Leon 0:694620b4c620 764 print_lettre(texte_minute[1]-32,taille_glob);
Leon 0:694620b4c620 765 strcpy(texte_minute_bk,texte_minute);
Leon 0:694620b4c620 766 difference=1;
Leon 0:694620b4c620 767 }
Leon 0:694620b4c620 768 if (strcmp(texte_heure, texte_heure_bk)!=0) {
Leon 0:694620b4c620 769 efface(267,107,304,135);
Leon 0:694620b4c620 770 X_print=275;
Leon 0:694620b4c620 771 Y_print=110;
Leon 0:694620b4c620 772 print_lettre(texte_heure[0]-32,taille_glob);
Leon 0:694620b4c620 773 X_print=290;
Leon 0:694620b4c620 774 print_lettre(texte_heure[1]-32,taille_glob);
Leon 0:694620b4c620 775 strcpy(texte_heure_bk,texte_heure);
Leon 0:694620b4c620 776 difference=1;
Leon 0:694620b4c620 777 }
Leon 0:694620b4c620 778 if ((outil_bk==1)&&(difference==1)) {
Leon 0:694620b4c620 779 set_outil(1,X_pos_bk,Y_pos_bk);
Leon 0:694620b4c620 780 //goto_2D_short(X_pos_bk,Y_pos_bk,2000);
Leon 0:694620b4c620 781 }
Leon 0:694620b4c620 782
Leon 0:694620b4c620 783 X_print=X_backup;
Leon 0:694620b4c620 784 Y_print=Y_backup;
Leon 0:694620b4c620 785 //X_pos=X_pos_bk;
Leon 0:694620b4c620 786 //Y_pos=Y_pos_bk;
Leon 0:694620b4c620 787 cons_servo_main=cons_servo_main_bk;
Leon 0:694620b4c620 788 precis=precis_bk;
Leon 0:694620b4c620 789 }
Leon 0:694620b4c620 790
Leon 0:694620b4c620 791 void efface_ligne (int line_nb)
Leon 0:694620b4c620 792 {
Leon 0:694620b4c620 793 float i;
Leon 0:694620b4c620 794 //set_outil(1);
Leon 0:694620b4c620 795 switch (line_nb) {
Leon 0:694620b4c620 796 case 1 :
Leon 0:694620b4c620 797 set_outil(1,0,112);
Leon 0:694620b4c620 798 //goto_2D_line(0,104);
Leon 0:694620b4c620 799 //wait(2);
Leon 0:694620b4c620 800 set_poignet(5);
Leon 0:694620b4c620 801 for (i=0; i<31; i=i+10.6) {
Leon 0:694620b4c620 802 goto_2D_line(0,112+i);//104
Leon 0:694620b4c620 803 //print_heure();
Leon 0:694620b4c620 804 goto_2D_line(120,116+i);//113
Leon 0:694620b4c620 805 print_heure();
Leon 0:694620b4c620 806 goto_2D_line(240,109+i);//104
Leon 0:694620b4c620 807 print_heure();
Leon 0:694620b4c620 808 //goto_2D_line(360,107+i);
Leon 0:694620b4c620 809 //goto_2D_line(360,107+i+5);
Leon 0:694620b4c620 810 goto_2D_line(265,108+i);
Leon 0:694620b4c620 811 print_heure();
Leon 0:694620b4c620 812 goto_2D_line(265,108+i+5.3);
Leon 0:694620b4c620 813 print_heure();
Leon 0:694620b4c620 814 goto_2D_line(240,109+i+5.3);
Leon 0:694620b4c620 815 print_heure();
Leon 0:694620b4c620 816 goto_2D_line(120,116+i+5.3);
Leon 0:694620b4c620 817 print_heure();
Leon 0:694620b4c620 818 goto_2D_line(0,112+i+5.3);
Leon 0:694620b4c620 819 //print_heure();
Leon 0:694620b4c620 820 }
Leon 0:694620b4c620 821 break;
Leon 0:694620b4c620 822 case 2 :
Leon 0:694620b4c620 823 set_outil(1,0,70);
Leon 0:694620b4c620 824 //goto_2D_line(0,70);
Leon 0:694620b4c620 825 //wait(2);
Leon 0:694620b4c620 826 set_poignet(5);
Leon 0:694620b4c620 827 for (i=0; i<31; i=i+10.6) { //8
Leon 0:694620b4c620 828 goto_2D_line(0,76+i);//104
Leon 0:694620b4c620 829 //print_heure();
Leon 0:694620b4c620 830 goto_2D_line(120,81+i);//113
Leon 0:694620b4c620 831 print_heure();
Leon 0:694620b4c620 832 goto_2D_line(240,78+i);//104
Leon 0:694620b4c620 833 print_heure();
Leon 0:694620b4c620 834 goto_2D_line(360,72+i);
Leon 0:694620b4c620 835 print_heure();
Leon 0:694620b4c620 836 goto_2D_line(360,72+i+5.3);
Leon 0:694620b4c620 837 print_heure();
Leon 0:694620b4c620 838 goto_2D_line(240,78+i+5.3);
Leon 0:694620b4c620 839 print_heure();
Leon 0:694620b4c620 840 goto_2D_line(120,81+i+5.3);
Leon 0:694620b4c620 841 print_heure();
Leon 0:694620b4c620 842 goto_2D_line(0,76+i+5.3);//4
Leon 0:694620b4c620 843 //print_heure();
Leon 0:694620b4c620 844 }
Leon 0:694620b4c620 845 break;
Leon 0:694620b4c620 846 case 3 :
Leon 0:694620b4c620 847 //goto_2D_line(0,37);
Leon 0:694620b4c620 848 set_outil(1,0,37);
Leon 0:694620b4c620 849 //wait(2);
Leon 0:694620b4c620 850 set_poignet(5);
Leon 0:694620b4c620 851 cons_servo_main=745;
Leon 0:694620b4c620 852 for (i=0; i<31; i=i+10.6) {
Leon 0:694620b4c620 853 goto_2D_line(0,39+i);//104
Leon 0:694620b4c620 854 //print_heure();
Leon 0:694620b4c620 855 goto_2D_line(120,46+i);//113
Leon 0:694620b4c620 856 print_heure();
Leon 0:694620b4c620 857 goto_2D_line(240,47+i);//104
Leon 0:694620b4c620 858 print_heure();
Leon 0:694620b4c620 859 goto_2D_line(360,44+i);
Leon 0:694620b4c620 860 print_heure();
Leon 0:694620b4c620 861 goto_2D_line(360,44+i+5.3);
Leon 0:694620b4c620 862 print_heure();
Leon 0:694620b4c620 863 goto_2D_line(240,47+i+5.3);
Leon 0:694620b4c620 864 print_heure();
Leon 0:694620b4c620 865 goto_2D_line(120,46+i+5.3);
Leon 0:694620b4c620 866 print_heure();
Leon 0:694620b4c620 867 goto_2D_line(0,39+i+5.3);
Leon 0:694620b4c620 868 }
Leon 0:694620b4c620 869 break;
Leon 0:694620b4c620 870
Leon 0:694620b4c620 871 case 4 :
Leon 0:694620b4c620 872 //goto_2D_line(0,5);
Leon 0:694620b4c620 873 set_outil(1,0,5);
Leon 0:694620b4c620 874 //wait(2);
Leon 0:694620b4c620 875 set_poignet(5);
Leon 0:694620b4c620 876 cons_servo_main=740;
Leon 0:694620b4c620 877 for (i=0; i<31; i=i+10.6) {
Leon 0:694620b4c620 878 goto_2D_line(0,5+i);//104
Leon 0:694620b4c620 879 //print_heure();
Leon 0:694620b4c620 880 goto_2D_line(120,12+i);//113
Leon 0:694620b4c620 881 print_heure();
Leon 0:694620b4c620 882 goto_2D_line(240,12+i);//104
Leon 0:694620b4c620 883 print_heure();
Leon 0:694620b4c620 884 goto_2D_line(360,8+i);
Leon 0:694620b4c620 885 print_heure();
Leon 0:694620b4c620 886 goto_2D_line(360,8+i+5.3);
Leon 0:694620b4c620 887 print_heure();
Leon 0:694620b4c620 888 goto_2D_line(240,12+i+5.3);
Leon 0:694620b4c620 889 print_heure();
Leon 0:694620b4c620 890 goto_2D_line(120,12+i+5.3);
Leon 0:694620b4c620 891 print_heure();
Leon 0:694620b4c620 892 goto_2D_line(0,5+i+5.3);
Leon 0:694620b4c620 893 }
Leon 0:694620b4c620 894 break;
Leon 0:694620b4c620 895 }
Leon 0:694620b4c620 896 set_poignet(4);
Leon 0:694620b4c620 897
Leon 0:694620b4c620 898 //set_outil(0);
Leon 0:694620b4c620 899 }
Leon 0:694620b4c620 900
Leon 0:694620b4c620 901 void retour_ligne(void)
Leon 0:694620b4c620 902 {
Leon 0:694620b4c620 903 switch (ligne) {
Leon 0:694620b4c620 904 case 1:
Leon 0:694620b4c620 905 remplissage[1]=1;
Leon 0:694620b4c620 906 if (remplissage[2]==1) {
Leon 0:694620b4c620 907 efface_ligne(2);
Leon 0:694620b4c620 908 }
Leon 0:694620b4c620 909 X_print=1;
Leon 0:694620b4c620 910 Y_print=77;
Leon 0:694620b4c620 911 ligne=2;
Leon 0:694620b4c620 912 break;
Leon 0:694620b4c620 913 case 2:
Leon 0:694620b4c620 914 remplissage[2]=1;
Leon 0:694620b4c620 915 if (remplissage[3]==1) {
Leon 0:694620b4c620 916 efface_ligne(3);
Leon 0:694620b4c620 917 }
Leon 0:694620b4c620 918 X_print=1;
Leon 0:694620b4c620 919 Y_print=44;
Leon 0:694620b4c620 920 ligne=3;
Leon 0:694620b4c620 921 break;
Leon 0:694620b4c620 922 case 3:
Leon 0:694620b4c620 923 remplissage[3]=1;
Leon 0:694620b4c620 924 if (remplissage[4]==1) {
Leon 0:694620b4c620 925 efface_ligne(4);
Leon 0:694620b4c620 926 }
Leon 0:694620b4c620 927 X_print=1;
Leon 0:694620b4c620 928 Y_print=11;
Leon 0:694620b4c620 929 ligne=4;
Leon 0:694620b4c620 930 break;
Leon 0:694620b4c620 931 case 4:
Leon 0:694620b4c620 932 remplissage[4]=1;
Leon 0:694620b4c620 933 if (remplissage[1]==1) {
Leon 0:694620b4c620 934 efface_ligne(1);
Leon 0:694620b4c620 935 }
Leon 0:694620b4c620 936 X_print=1;
Leon 0:694620b4c620 937 Y_print=110;
Leon 0:694620b4c620 938 ligne=1;
Leon 0:694620b4c620 939 break;
Leon 0:694620b4c620 940 }
Leon 0:694620b4c620 941 }
Leon 0:694620b4c620 942
Leon 0:694620b4c620 943 void print_heure_initial(void)
Leon 0:694620b4c620 944 {
Leon 0:694620b4c620 945 char texte_heure[10];
Leon 0:694620b4c620 946 //float X_backup, Y_backup;
Leon 0:694620b4c620 947
Leon 0:694620b4c620 948 struct tm * timeinfo;
Leon 0:694620b4c620 949 time_t seconds = time(NULL);
Leon 0:694620b4c620 950 timeinfo = localtime (&seconds);
Leon 0:694620b4c620 951 strftime(texte_heure_bk,10,"%H",timeinfo);
Leon 0:694620b4c620 952 strftime(texte_minute_bk,10,"%M",timeinfo);
Leon 0:694620b4c620 953 X_print=275;
Leon 0:694620b4c620 954 Y_print=110;
Leon 0:694620b4c620 955 print_lettre(texte_heure_bk[0]-32,taille_glob);
Leon 0:694620b4c620 956 X_print=290;
Leon 0:694620b4c620 957 print_lettre(texte_heure_bk[1]-32,taille_glob);
Leon 0:694620b4c620 958 X_print=310;
Leon 0:694620b4c620 959 print_lettre(104-32,taille_glob);
Leon 0:694620b4c620 960 X_print=330;
Leon 0:694620b4c620 961 print_lettre(texte_minute_bk[0]-32,taille_glob);
Leon 0:694620b4c620 962 X_print=345;
Leon 0:694620b4c620 963 print_lettre(texte_minute_bk[1]-32,taille_glob);
Leon 0:694620b4c620 964 }
Leon 0:694620b4c620 965
Leon 0:694620b4c620 966
Leon 0:694620b4c620 967 void print_chaine(char* chaine)
Leon 0:694620b4c620 968 {
Leon 0:694620b4c620 969 int i=0;
Leon 0:694620b4c620 970 int i_fictif=0;
Leon 0:694620b4c620 971 int retour_ligne_loc=0;
Leon 0:694620b4c620 972 int rupt=0;
Leon 0:694620b4c620 973 while (chaine[i]!=0) {
Leon 0:694620b4c620 974 print_heure();
Leon 0:694620b4c620 975 retour_ligne_loc=0;
Leon 0:694620b4c620 976 //printf("interp: %d\r\n",chaine[i]);
Leon 0:694620b4c620 977 if (chaine[i]>31) {
Leon 0:694620b4c620 978 print_lettre(chaine[i]-32,taille_glob);
Leon 0:694620b4c620 979 } else if (chaine[i]==10) {
Leon 0:694620b4c620 980 retour_ligne();
Leon 0:694620b4c620 981 //X_print=1;
Leon 0:694620b4c620 982 //Y_print=Y_print-22*taille_glob;
Leon 0:694620b4c620 983 }
Leon 0:694620b4c620 984 if ((X_print>345)||((ligne==1)&&(X_print>270))) {
Leon 0:694620b4c620 985 retour_ligne();
Leon 0:694620b4c620 986 //X_print=1;
Leon 0:694620b4c620 987 //Y_print=Y_print-22*taille_glob;
Leon 0:694620b4c620 988 retour_ligne_loc=1;
Leon 0:694620b4c620 989 }
Leon 0:694620b4c620 990 //i++;
Leon 0:694620b4c620 991 if ((chaine[i]==32)&&(retour_ligne_loc==0)) { //determine si retour a la ligne suite a espace
Leon 0:694620b4c620 992 X_fictif=X_print;
Leon 0:694620b4c620 993 i_fictif=i+1;
Leon 0:694620b4c620 994 rupt=0;
Leon 0:694620b4c620 995 while (rupt==0) { //on fait avancer X_fictif jusqu'au prochain caractère espace ou retour ou fin
Leon 0:694620b4c620 996 if (chaine[i_fictif]>31) {
Leon 0:694620b4c620 997 print_lettre_fictif(chaine[i_fictif]-32,taille_glob);
Leon 0:694620b4c620 998 }
Leon 0:694620b4c620 999 //pc.printf("Xfictif %f\r\n",X_fictif);
Leon 0:694620b4c620 1000 if ((X_fictif>345)||((ligne==1)&&(X_fictif>270))) {
Leon 0:694620b4c620 1001 rupt=2;
Leon 0:694620b4c620 1002 }
Leon 0:694620b4c620 1003 if ((chaine[i_fictif]==32)||(chaine[i_fictif]==10)||(chaine[i_fictif]==0)) {
Leon 0:694620b4c620 1004 rupt=1;
Leon 0:694620b4c620 1005 //pc.printf("rupt 1 %d\r\n",chaine[i_fictif]);
Leon 0:694620b4c620 1006 }
Leon 0:694620b4c620 1007 i_fictif++;
Leon 0:694620b4c620 1008 }
Leon 0:694620b4c620 1009 if (rupt==2) {
Leon 0:694620b4c620 1010 retour_ligne();
Leon 0:694620b4c620 1011 //X_print=1;
Leon 0:694620b4c620 1012 //Y_print=Y_print-22*taille_glob;
Leon 0:694620b4c620 1013 //pc.printf("rupt 2\r\n");
Leon 0:694620b4c620 1014 }
Leon 0:694620b4c620 1015 }
Leon 0:694620b4c620 1016 i++;
Leon 0:694620b4c620 1017 }
Leon 0:694620b4c620 1018 }
Leon 0:694620b4c620 1019
Leon 0:694620b4c620 1020
Leon 0:694620b4c620 1021
Leon 0:694620b4c620 1022
Leon 0:694620b4c620 1023
Leon 0:694620b4c620 1024 int main()
Leon 0:694620b4c620 1025 {
Leon 0:694620b4c620 1026 FILE* fileid;
Leon 0:694620b4c620 1027 int i,j,k;
Leon 0:694620b4c620 1028 char montexte[600];
Leon 0:694620b4c620 1029 float aaa, bbb, ccc, ddd, eee;
Leon 0:694620b4c620 1030
Leon 0:694620b4c620 1031 struct tm * timeinfo;
Leon 0:694620b4c620 1032
Leon 0:694620b4c620 1033 time_t seconds = time(NULL);
Leon 0:694620b4c620 1034 // ********* initialisations *******
Leon 0:694620b4c620 1035 //while(1){}
Leon 0:694620b4c620 1036 pc.baud(115200);
Leon 0:694620b4c620 1037 pc.printf("bijour\r\n");
Leon 0:694620b4c620 1038 tick_attached_coude=0;
Leon 0:694620b4c620 1039 tick_attached_epaule=0;
Leon 0:694620b4c620 1040 X_print=1;
Leon 0:694620b4c620 1041 Y_print=110; //110
Leon 0:694620b4c620 1042 ligne=1;
Leon 0:694620b4c620 1043 precis=0;
Leon 0:694620b4c620 1044 outil=0;
Leon 0:694620b4c620 1045 taille_glob=1.5;
Leon 0:694620b4c620 1046 appel_servo.attach_us(&tick_servo, 20000);
Leon 0:694620b4c620 1047 //myled=1;
Leon 0:694620b4c620 1048 //wait(1);
Leon 0:694620b4c620 1049 //myled=0;
Leon 0:694620b4c620 1050 //while(1) {
Leon 0:694620b4c620 1051 // aaa=potard_1.read();
Leon 0:694620b4c620 1052 // i=switch_epaule.read();
Leon 0:694620b4c620 1053 // j=switch_coude.read();
Leon 0:694620b4c620 1054 // pc.printf("S1:%i S2:%i potard:%f\r\n", i,j,aaa);
Leon 0:694620b4c620 1055 // wait(1);
Leon 0:694620b4c620 1056 //}
Leon 0:694620b4c620 1057
Leon 0:694620b4c620 1058 //for (i=1;i<150;i++) {
Leon 0:694620b4c620 1059 // pc.printf("i= %d",i);
Leon 0:694620b4c620 1060 // stepper_clk_1=1;
Leon 0:694620b4c620 1061 // stepper_clk_2=1;
Leon 0:694620b4c620 1062 // wait_us(10);
Leon 0:694620b4c620 1063 // stepper_clk_1=0;
Leon 0:694620b4c620 1064 // stepper_clk_2=0;
Leon 0:694620b4c620 1065 // wait_ms(1000);
Leon 0:694620b4c620 1066 //}
Leon 0:694620b4c620 1067 cons_servo_main=servo_neutre;
Leon 0:694620b4c620 1068 wait(1);
Leon 0:694620b4c620 1069
Leon 0:694620b4c620 1070 //while(1) {
Leon 0:694620b4c620 1071 // cons_servo_main=1800;
Leon 0:694620b4c620 1072 // wait(3);
Leon 0:694620b4c620 1073 // cons_servo_main=1200;
Leon 0:694620b4c620 1074 // wait(3);
Leon 0:694620b4c620 1075 // }
Leon 0:694620b4c620 1076
Leon 0:694620b4c620 1077 fileid=fopen("/local/input.txt", "r");
Leon 0:694620b4c620 1078 fread(montexte,1,500,fileid);
Leon 0:694620b4c620 1079
Leon 0:694620b4c620 1080 montexte[500]=0;
Leon 0:694620b4c620 1081 fclose(fileid);
Leon 0:694620b4c620 1082 for (i=0; i<38; i++) {
Leon 0:694620b4c620 1083 printf(":%d\r\n",montexte[i]);
Leon 0:694620b4c620 1084 }
Leon 0:694620b4c620 1085 pc.printf("Time brut = %d\r\n", seconds);
Leon 0:694620b4c620 1086 pc.printf("Time = %s", ctime(&seconds));
Leon 0:694620b4c620 1087 //set_time(1503151338);//set_time(1336478783);
Leon 0:694620b4c620 1088 timeinfo = localtime (&seconds);
Leon 0:694620b4c620 1089
Leon 0:694620b4c620 1090 //strftime(montexte,10,"%Hh%M",timeinfo);
Leon 0:694620b4c620 1091 //pc.printf(montexte);
Leon 0:694620b4c620 1092
Leon 0:694620b4c620 1093 init_stepper();
Leon 0:694620b4c620 1094 //setpos_ang (0, 0, 3000);
Leon 0:694620b4c620 1095 //tick_detach();
Leon 0:694620b4c620 1096 //set_poignet(1);
Leon 0:694620b4c620 1097 //wait(5);
Leon 0:694620b4c620 1098 //set_poignet(3);
Leon 0:694620b4c620 1099 //setpos_ang (-850, 0, 3000);
Leon 0:694620b4c620 1100 //tick_detach();
Leon 0:694620b4c620 1101 //set_poignet(5);
Leon 0:694620b4c620 1102 //wait(5);
Leon 0:694620b4c620 1103 //set_poignet(3);
Leon 0:694620b4c620 1104 //goto_2D_short(0,0,3000);
Leon 0:694620b4c620 1105 //set_poignet(1);
Leon 0:694620b4c620 1106 //goto_2D_line(360,0);
Leon 0:694620b4c620 1107 //goto_2D_line(360,140);
Leon 0:694620b4c620 1108 //goto_2D_line(0,140);
Leon 0:694620b4c620 1109 //goto_2D_line(0,0);
Leon 0:694620b4c620 1110 //wait(2);
Leon 0:694620b4c620 1111 //set_outil(1);
Leon 0:694620b4c620 1112 //goto_2D_line(0,0);
Leon 0:694620b4c620 1113 //set_poignet(5);
Leon 0:694620b4c620 1114 //goto_2D_line(360,0);
Leon 0:694620b4c620 1115 //goto_2D_line(360,140);
Leon 0:694620b4c620 1116 //goto_2D_line(0,140);
Leon 0:694620b4c620 1117 //goto_2D_line(0,0);
Leon 0:694620b4c620 1118 //set_outil(0);
Leon 0:694620b4c620 1119 //printf(montexte);
Leon 0:694620b4c620 1120
Leon 0:694620b4c620 1121 //wait (4);
Leon 0:694620b4c620 1122 myled=!myled;
Leon 0:694620b4c620 1123 //setpos_ang (0, 0, 3000);
Leon 0:694620b4c620 1124 //tick_detach();
Leon 0:694620b4c620 1125 //set_poignet(1);
Leon 0:694620b4c620 1126 //wait(20);
Leon 0:694620b4c620 1127 goto_2D_short (0,110, 1000);
Leon 0:694620b4c620 1128 tick_detach();
Leon 0:694620b4c620 1129 //goto_2D_line(0,134);
Leon 0:694620b4c620 1130 //set_poignet(1);
Leon 0:694620b4c620 1131 //goto_2D_line(360,134);
Leon 0:694620b4c620 1132 //set_poignet(2);
Leon 0:694620b4c620 1133 //goto_2D_line(360,104);
Leon 0:694620b4c620 1134 //set_poignet(1);
Leon 0:694620b4c620 1135 //goto_2D_line(0,104);
Leon 0:694620b4c620 1136 //set_poignet(2);
Leon 0:694620b4c620 1137 //goto_2D_line(0,101);
Leon 0:694620b4c620 1138 //set_poignet(1);
Leon 0:694620b4c620 1139 //goto_2D_line(360,101);
Leon 0:694620b4c620 1140 //set_poignet(2);
Leon 0:694620b4c620 1141 //goto_2D_line(360,71);
Leon 0:694620b4c620 1142 //set_poignet(1);
Leon 0:694620b4c620 1143 //goto_2D_line(0,71);
Leon 0:694620b4c620 1144 //set_poignet(2);
Leon 0:694620b4c620 1145 //goto_2D_line(0,68);
Leon 0:694620b4c620 1146 //set_poignet(1);
Leon 0:694620b4c620 1147 //goto_2D_line(360,68);
Leon 0:694620b4c620 1148 //set_poignet(2);
Leon 0:694620b4c620 1149 //goto_2D_line(360,38);
Leon 0:694620b4c620 1150 //set_poignet(1);
Leon 0:694620b4c620 1151 //goto_2D_line(0,38);
Leon 0:694620b4c620 1152 //set_poignet(2);
Leon 0:694620b4c620 1153 //goto_2D_line(0,35);
Leon 0:694620b4c620 1154 //set_poignet(1);
Leon 0:694620b4c620 1155 //goto_2D_line(360,35);
Leon 0:694620b4c620 1156 //set_poignet(2);
Leon 0:694620b4c620 1157 //goto_2D_line(360,5);
Leon 0:694620b4c620 1158 //set_poignet(1);
Leon 0:694620b4c620 1159 //goto_2D_line(0,5);
Leon 0:694620b4c620 1160 //set_poignet(2);
Leon 0:694620b4c620 1161 //wait(1);
Leon 0:694620b4c620 1162 //efface_ligne(4);
Leon 0:694620b4c620 1163 //setpos_ang (-850, 0, 1000);
Leon 0:694620b4c620 1164 //setpos_ang (0, 0, 3000);
Leon 0:694620b4c620 1165 //tick_detach();
Leon 0:694620b4c620 1166 //wait(10);
Leon 0:694620b4c620 1167 //cons_servo_main=servo_gomme_pos;
Leon 0:694620b4c620 1168 //print_chaine(ctime(&seconds));
Leon 0:694620b4c620 1169
Leon 0:694620b4c620 1170 print_heure_initial();
Leon 0:694620b4c620 1171 X_print=1;
Leon 0:694620b4c620 1172 Y_print=110;//110
Leon 0:694620b4c620 1173 //taille_glob=3;
Leon 0:694620b4c620 1174 //print_chaine("ROB");
Leon 0:694620b4c620 1175
Leon 0:694620b4c620 1176 //circle_2D(108,68,8,-1.57,-3.14);//98
Leon 0:694620b4c620 1177 //goto_2D_line(100,100);//90
Leon 0:694620b4c620 1178 //circle_2D(108,100,8,3.14,1.57);//98
Leon 0:694620b4c620 1179 //goto_2D_line(140,108);//130
Leon 0:694620b4c620 1180 //circle_2D(140,100,8,1.57,0);//130
Leon 0:694620b4c620 1181 //goto_2D_line(148,68);//138
Leon 0:694620b4c620 1182 //circle_2D(140,68,8,0,-1.57);//130
Leon 0:694620b4c620 1183 //goto_2D_line(108,60);//98
Leon 0:694620b4c620 1184 //set_poignet(2);
Leon 0:694620b4c620 1185
Leon 0:694620b4c620 1186 //circle_2D (114,88,6,-3.14,3.14);//104
Leon 0:694620b4c620 1187 //circle_2D (134,88,6,-3.14,3.14);//124
Leon 0:694620b4c620 1188 //circle_2D(96,84,15,1.57,4.71);//86
Leon 0:694620b4c620 1189 //goto_2D_line(96,99);//86
Leon 0:694620b4c620 1190 //set_poignet(2);
Leon 0:694620b4c620 1191
Leon 0:694620b4c620 1192 //circle_2D(152,84,15,1.57,-1.57);//142
Leon 0:694620b4c620 1193 //goto_2D_line(152,99);//142
Leon 0:694620b4c620 1194 //set_poignet(2);
Leon 0:694620b4c620 1195 //circle_2D(124,108,15,3.14,0);//114
Leon 0:694620b4c620 1196 //set_poignet(2);
Leon 0:694620b4c620 1197 //goto_2D_line(124,123);//114
Leon 0:694620b4c620 1198 //set_poignet(1);
Leon 0:694620b4c620 1199 //goto_2D_line(124,135);//114
Leon 0:694620b4c620 1200 //set_poignet(2);
Leon 0:694620b4c620 1201 //circle_2D(124,140,5,-3.14,3.14);//114
Leon 0:694620b4c620 1202
Leon 0:694620b4c620 1203 //X_print=165;
Leon 0:694620b4c620 1204 //print_chaine("T");
Leon 0:694620b4c620 1205 //taille_glob=1.5;
Leon 0:694620b4c620 1206 //X_print=20;
Leon 0:694620b4c620 1207 //Y_print=30;
Leon 0:694620b4c620 1208 //print_chaine("- MAKER.COM");
Leon 0:694620b4c620 1209 //set_poignet(2);
Leon 0:694620b4c620 1210 //goto_2D_line(350,130);
Leon 0:694620b4c620 1211 //set_poignet(3);
Leon 0:694620b4c620 1212 //while(1) {}
Leon 0:694620b4c620 1213
Leon 0:694620b4c620 1214 while(1) {
Leon 0:694620b4c620 1215 //print_chaine("Bonjour a tous!");
Leon 0:694620b4c620 1216 print_chaine(montexte);
Leon 0:694620b4c620 1217 //set_outil(1);
Leon 0:694620b4c620 1218 //wait(2);
Leon 0:694620b4c620 1219 //set_outil(0);
Leon 0:694620b4c620 1220 //efface(1,20,300,44);//110 134
Leon 0:694620b4c620 1221 }
Leon 0:694620b4c620 1222 while(1) {}
Leon 0:694620b4c620 1223 while(1) {
Leon 0:694620b4c620 1224 for (i=26; i<40; i++) {
Leon 0:694620b4c620 1225 print_lettre (i,2);
Leon 0:694620b4c620 1226 }
Leon 0:694620b4c620 1227 X_print=20;
Leon 0:694620b4c620 1228 Y_print=30;
Leon 0:694620b4c620 1229 goto_2D_line(20,40);
Leon 0:694620b4c620 1230 for (i=40; i<53; i++) {
Leon 0:694620b4c620 1231 print_lettre (i,2);
Leon 0:694620b4c620 1232 }
Leon 0:694620b4c620 1233 goto_2D_line(350,100);
Leon 0:694620b4c620 1234 //print_lettre(1, 2);
Leon 0:694620b4c620 1235 //print_lettre(2, 2);
Leon 0:694620b4c620 1236 //print_lettre(3, 2);
Leon 0:694620b4c620 1237 //print_lettre(4, 2);
Leon 0:694620b4c620 1238 //print_lettre(5, 2);
Leon 0:694620b4c620 1239 //print_lettre(6, 2);
Leon 0:694620b4c620 1240 //X_print=10;
Leon 0:694620b4c620 1241 //Y_print=10;
Leon 0:694620b4c620 1242 //print_lettre(1, 2);
Leon 0:694620b4c620 1243 //print_lettre(2, 2);
Leon 0:694620b4c620 1244 //print_lettre(3, 2);
Leon 0:694620b4c620 1245 //print_lettre(4, 2);
Leon 0:694620b4c620 1246 //print_lettre(5, 2);
Leon 0:694620b4c620 1247 //print_lettre(6, 2);
Leon 0:694620b4c620 1248 wait(15);
Leon 0:694620b4c620 1249 X_print=1;
Leon 0:694620b4c620 1250 Y_print=60;
Leon 0:694620b4c620 1251 }
Leon 0:694620b4c620 1252 //cons_servo_main=1800;//1800
Leon 0:694620b4c620 1253 set_poignet(3);
Leon 0:694620b4c620 1254
Leon 0:694620b4c620 1255 while (1) {
Leon 0:694620b4c620 1256
Leon 0:694620b4c620 1257 wait(1);
Leon 0:694620b4c620 1258
Leon 0:694620b4c620 1259 goto_2D_line(50,10);
Leon 0:694620b4c620 1260 goto_2D_line(50,70);
Leon 0:694620b4c620 1261 circle_2D(50, 55, 15, 1.57, -1.57);
Leon 0:694620b4c620 1262 circle_2D(50, 25, 15, 1.57, -1.57);
Leon 0:694620b4c620 1263 wait(2);
Leon 0:694620b4c620 1264 goto_2D_line(360,0);
Leon 0:694620b4c620 1265 myled=!myled;
Leon 0:694620b4c620 1266 goto_2D_line(360,110);
Leon 0:694620b4c620 1267 myled=!myled;
Leon 0:694620b4c620 1268 goto_2D_line(0,110);
Leon 0:694620b4c620 1269 myled=!myled;
Leon 0:694620b4c620 1270 goto_2D_line(0,0);//
Leon 0:694620b4c620 1271 myled=!myled;
Leon 0:694620b4c620 1272 //goto_2D_line(180,0);
Leon 0:694620b4c620 1273 //myled=!myled;
Leon 0:694620b4c620 1274 //goto_2D_line(180,110);
Leon 0:694620b4c620 1275 //myled=!myled;
Leon 0:694620b4c620 1276 //goto_2D_line(360,110);
Leon 0:694620b4c620 1277 //myled=!myled;
Leon 0:694620b4c620 1278 //goto_2D_line(360,0);
Leon 0:694620b4c620 1279 //myled=!myled;
Leon 0:694620b4c620 1280 //goto_2D_line(180,0);
Leon 0:694620b4c620 1281 //myled=!myled;
Leon 0:694620b4c620 1282 //goto_2D_line(180,110);
Leon 0:694620b4c620 1283 //myled=!myled;
Leon 0:694620b4c620 1284 //goto_2D_line(0,110);
Leon 0:694620b4c620 1285 //myled=!myled;
Leon 0:694620b4c620 1286 //goto_2D_line(0,0);
Leon 0:694620b4c620 1287 circle_2D(180, 55, 55, 0, 4.7);
Leon 0:694620b4c620 1288 circle_2D(180, 55, 20, -1.57, 1.57);
Leon 0:694620b4c620 1289 circle_2D(210, 55, 20, -1.57, 1.57);
Leon 0:694620b4c620 1290 circle_2D(250, 55, 20, -1.57, 1.57);
Leon 0:694620b4c620 1291 circle_2D(290, 55, 20, -1.57, 1.57);
Leon 0:694620b4c620 1292
Leon 0:694620b4c620 1293 //myled=!myled;
Leon 0:694620b4c620 1294 //goto_2D_short (180,0, 1000);
Leon 0:694620b4c620 1295 //wait(2);
Leon 0:694620b4c620 1296 //myled=!myled;
Leon 0:694620b4c620 1297 //goto_2D_short (360,0, 1000);
Leon 0:694620b4c620 1298 //wait(2);
Leon 0:694620b4c620 1299 //myled=!myled;
Leon 0:694620b4c620 1300 //goto_2D_short (360,110, 1000);
Leon 0:694620b4c620 1301 //wait(2);
Leon 0:694620b4c620 1302 //myled=!myled;
Leon 0:694620b4c620 1303 //goto_2D_short (180,110, 1000);
Leon 0:694620b4c620 1304 //wait(2);
Leon 0:694620b4c620 1305 //myled=!myled;
Leon 0:694620b4c620 1306 //goto_2D_short (0,110, 1000);
Leon 0:694620b4c620 1307 //wait(2)
Leon 0:694620b4c620 1308 //goto_2D_short (360,110);
Leon 0:694620b4c620 1309 }
Leon 0:694620b4c620 1310 while(1) {}
Leon 0:694620b4c620 1311
Leon 0:694620b4c620 1312 a_coude=0;
Leon 0:694620b4c620 1313 a_epaule=0;
Leon 0:694620b4c620 1314 aaa=1000;
Leon 0:694620b4c620 1315 bbb=0;
Leon 0:694620b4c620 1316 while (1) {
Leon 0:694620b4c620 1317 myled=!myled;
Leon 0:694620b4c620 1318 setpos_ang (aaa,bbb, 2000);
Leon 0:694620b4c620 1319 myled=!myled;
Leon 0:694620b4c620 1320 setpos_ang (aaa,aaa, 2000);
Leon 0:694620b4c620 1321 myled=!myled;
Leon 0:694620b4c620 1322 setpos_ang (bbb,aaa, 500);
Leon 0:694620b4c620 1323 myled=!myled;
Leon 0:694620b4c620 1324 setpos_ang (bbb,bbb, 500);
Leon 0:694620b4c620 1325 }
Leon 0:694620b4c620 1326
Leon 0:694620b4c620 1327
Leon 0:694620b4c620 1328 while(1) {
Leon 0:694620b4c620 1329 myled = 1;
Leon 0:694620b4c620 1330 wait(0.2);
Leon 0:694620b4c620 1331 myled = 0;
Leon 0:694620b4c620 1332 wait(0.2);
Leon 0:694620b4c620 1333 }
Leon 0:694620b4c620 1334 }