i am trying to do a proyect for my university but i have some mistakes and i don´t know why. I appreciate any help.
the code:
int y[1600];
int x[1600];
double Va, Vb;
int n, l = 0, j = 0, k = 0, M, A = 4096;
float T = 1e6 / 60;
void setup() {
Serial.begin (9600);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
M = 4;
for (n = 0; n < M; n++)
{
if ((n < M / 4))
{ y[n] = (j∗A) / (M / 4);
j++;
}
if ((n >= M / 4) && (n < (3∗M) / 4))
{ y[n] = (j∗A) / (M / 4);
j−−;
}
if (n >= (3∗M) / 4)
{ y[n] = (j∗A) / (M / 4);
j++;
}
}
for (n = 0; n < M; n++)
{
x[n] = (l / 4) * A
l++
}
}
void loop () {
Va = 4096 ∗ sin( 2 ∗ 3.1415 / T ∗ micros()) ;
//Vb=(2048 * sin ( 2∗3.1415/T∗ micros()))+2048;
if (Va >= (y[k] / 2 + A / 2)) {
digitalWrite (13, HIGH);
} else {
digitalWrite (13, LOW) ;
}
//if(Va>=(y [k]/2−A/2)){ digitalWrite(13,LOW) ;}else{digitalWrite (13,HIGH) ;}
if ( Va >= (x[k] / 2 + A / 2)) {
digitalWrite (12, HIGH) ;
} else {
digitalWrite(12, LOW) ;
}
//if( Va>=(x[k]/2−A/2)){digitalWrite(11,LOW) ;}else{digitalWrite(11,HIGH) ;}
k++;
if (k == M) {
k = 0;
}
}
Arduino:1.8.1 (Windows 10), Tarjeta:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
round_2_mi_codigo_con_todas_las_salidas:18: error: stray '\342' in program
{ y[n] = (j∗A) / (M / 4);
^
round_2_mi_codigo_con_todas_las_salidas:18: error: stray '\210' in program
round_2_mi_codigo_con_todas_las_salidas:18: error: stray '\227' in program
round_2_mi_codigo_con_todas_las_salidas:21: error: stray '\342' in program
if ((n >= M / 4) && (n < (3∗M) / 4))
^
round_2_mi_codigo_con_todas_las_salidas:21: error: stray '\210' in program
round_2_mi_codigo_con_todas_las_salidas:21: error: stray '\227' in program
round_2_mi_codigo_con_todas_las_salidas:22: error: stray '\342' in program
{ y[n] = (j∗A) / (M / 4);
^
round_2_mi_codigo_con_todas_las_salidas:22: error: stray '\210' in program
round_2_mi_codigo_con_todas_las_salidas:22: error: stray '\227' in program
round_2_mi_codigo_con_todas_las_salidas:23: error: stray '\342' in program
j−−;
^
round_2_mi_codigo_con_todas_las_salidas:23: error: stray '\210' in program
round_2_mi_codigo_con_todas_las_salidas:23: error: stray '\222' in program
round_2_mi_codigo_con_todas_las_salidas:23: error: stray '\342' in program
round_2_mi_codigo_con_todas_las_salidas:23: error: stray '\210' in program
round_2_mi_codigo_con_todas_las_salidas:23: error: stray '\222' in program
round_2_mi_codigo_con_todas_las_salidas:25: error: stray '\342' in program
if (n >= (3∗M) / 4)
^
round_2_mi_codigo_con_todas_las_salidas:25: error: stray '\210' in program
round_2_mi_codigo_con_todas_las_salidas:25: error: stray '\227' in program
round_2_mi_codigo_con_todas_las_salidas:26: error: stray '\342' in program
{ y[n] = (j∗A) / (M / 4);
^
round_2_mi_codigo_con_todas_las_salidas:26: error: stray '\210' in program
round_2_mi_codigo_con_todas_las_salidas:26: error: stray '\227' in program
round_2_mi_codigo_con_todas_las_salidas:39: error: stray '\342' in program
Va = 4096 ∗ sin( 2 ∗ 3.1415 / T ∗ micros()) ;
^
round_2_mi_codigo_con_todas_las_salidas:39: error: stray '\210' in program
round_2_mi_codigo_con_todas_las_salidas:39: error: stray '\227' in program
round_2_mi_codigo_con_todas_las_salidas:39: error: stray '\342' in program
round_2_mi_codigo_con_todas_las_salidas:39: error: stray '\210' in program
round_2_mi_codigo_con_todas_las_salidas:39: error: stray '\227' in program
round_2_mi_codigo_con_todas_las_salidas:39: error: stray '\342' in program
round_2_mi_codigo_con_todas_las_salidas:39: error: stray '\210' in program
round_2_mi_codigo_con_todas_las_salidas:39: error: stray '\227' in program
C:\Users\SAMSUNGPC\Documents\materias UD\elepot\round_2_mi_codigo_con_todas_las_salidas\round_2_mi_codigo_con_todas_las_salidas.ino: In function 'void setup()':
round_2_mi_codigo_con_todas_las_salidas:18: error: expected ')' before 'A'
{ y[n] = (j∗A) / (M / 4);
^
round_2_mi_codigo_con_todas_las_salidas:21: error: expected ')' before 'M'
if ((n >= M / 4) && (n < (3∗M) / 4))
^
round_2_mi_codigo_con_todas_las_salidas:25: error: expected ')' before 'if'
if (n >= (3∗M) / 4)
^
round_2_mi_codigo_con_todas_las_salidas:29: error: expected ')' before '}' token
}
^
round_2_mi_codigo_con_todas_las_salidas:29: error: expected primary-expression before '}' token
round_2_mi_codigo_con_todas_las_salidas:33: error: expected ';' before 'l'
l++
^
C:\Users\SAMSUNGPC\Documents\materias UD\elepot\round_2_mi_codigo_con_todas_las_salidas\round_2_mi_codigo_con_todas_las_salidas.ino: In function 'void loop()':
round_2_mi_codigo_con_todas_las_salidas:39: error: expected ';' before 'sin'
Va = 4096 ∗ sin( 2 ∗ 3.1415 / T ∗ micros()) ;
^
exit status 1
stray '\342' in program