Counter

Hello, I have been trying to get a counter which increases by 1, the problem is that it doesnt increase and i get this really strange symbol.

This is part of my code

int a=0;

void setup
{
}

void loop
{
a=a+1;( I have also tried a++;)
}

I just dont get it, it is always 0, please help

where do you get this symbol?

Im using the serial print, sometimes i get like 1111 it's a really strange thing, i dont know what it is, rigth now, im getting just "0,0,0,0" it just doesnt increases.

I have a kind of long code, is it maybe this?

junitinn:
Im using the serial print, sometimes i get like 1111 it's a really strange thing, i dont know what it is, rigth now, im getting just "0,0,0,0" it just doesnt increases.

I have a kind of long code, is it maybe this?

We can't see your code unless you post it.

the example you gave does nothing to try to help you.

file:///Users/jorgequintero/Desktop/Captura%20de%20pantalla%202016-01-09%20a%20las%201.25.12%20p.m..png

Can you see that?, that's what im gettin :confused:

This is my code

int col[]={2,9};
int col2[]={3,4,5,6,7,8};
int fila[]={10,11,12,13,14,15,16,17};
int a=0;

void setup() // Prog_37_1
{

for (int i=0;i<=1;i++)
{
pinMode(col*,OUTPUT); *
_ digitalWrite(col*,HIGH);_
_
}_
_
for (int i=0;i<=5;i++)_
_
{_
_ pinMode(col2,OUTPUT);
digitalWrite(col2,HIGH);
}
for(int t=0;t<=7;t++)
{
pinMode(fila[t],OUTPUT);
digitalWrite(fila[t],LOW);
}*_

* pinMode(19,INPUT);*
* pinMode(18,INPUT);*
* Serial.begin(9600);*
* }*
void loop()
{

* int matriz[2][8]; //Creamos la matriz para las dos plataformas*
* int matriz1[5][8]; //Creamos la matriz en donde se movera la pelota*

* for (int t=0;t<8;t++)*
* {*
* matriz[0][t]=0; //Siempre hay que llenarlas con 0, eso significara que ese punto esta apagado*
* matriz[1][t]=0; //Llenando con 0*
* }*

* for (int m=0;m<6;m++)*
* {*
* for (int b=0;b<8;b++)*
* {*
_ matriz1[m]=0; //Llenando con 0_
__ matriz1[m]=0; //Llenando con 0__

** }**
** } **
** int l= (analogRead(19))/147; //Tomamos la medida del potenciometro, esto nos indicara donde se desea poner la plataforma**
** int y= (analogRead(18))/147; //Tomamos la medida del potenciometro, esto nos indicara donde se desea poner la plataforma**

** matriz[0][y]=1; //Asignamos 1 a estos puntos, 1 significara prendido**
** matriz[0][y+1]=1; //Asignamos 1 a estos puntos, 1 significara prendido**
** matriz[1][l]=1; //Asignamos 1 a estos puntos, 1 significara prendido**
** matriz[1][l+1]=1; //Asignamos 1 a estos puntos, 1 significara prendido**

for (int x=0;x<2;x++) //Debido a que no se pueden prender de la forma en que se quieren los leds, lo que se hace es prenderlos y apagarlos de a uno por uno, tan rapido, que parece que todos estuvieran prendidos al tiempo
{
** for (int y=0;y<8;y++)**
** {**

** if(matriz[x][y]==1) //Se recorre la matriz en busca de 1, es decir leds prendidos**
** { **
** digitalWrite(col[x],LOW); //Se prende el catodo**
** digitalWrite(fila[y],HIGH); //Se prende el anodo**
** delay(1);**
** digitalWrite(col[x],HIGH); //Se apaga el catodo**
** digitalWrite(fila[y],LOW); //Se apaga el anodo**
** } **
** }**
}

**for (int x=0;x<6;x++) **
{
** for (int y=0;y<8;y++)**
** {**

** if(matriz1[x][y]==1) //Se recorre la matriz en busca de 1, es decir leds prendidos**
** { **
** digitalWrite(col2[x],LOW); //Se prende el catodo**
** digitalWrite(fila[y],HIGH); //Se prende el anodo**
** delay(1);**
** digitalWrite(col2[x],HIGH); //Se apaga el catodo**
** digitalWrite(fila[y],LOW); //Se apaga el anodo**
** } **
** }**
}
a=a+1;
Serial.println(a);
** }**

At the beggining you can find where I supposed a=0; at the end im trying to increase

Read this thread and edit your post

Thanks bro

junitinn:
Thanks bro

Pay attention! You forgot something:

and edit your post