Graph output is not working

I'm having troubles with the output of this graph in my arduino. The serial print output should look like this.

25 42 ********** 51 42 ********** 76 42 ********** 102 42 ********** 128 42 ********** 153 42 ********** 179 42 ********** 204 42 ********** 230 42 ********** 256 42 ********** 281 42 ********** 307 42 ********** 332 42 ********** 358 42 ********** 384 42 ********** 409 42 ********** 435 42 ********** 460 42 ********** 487 42 ********** 513 42 ********** 538 42 ********** 564 42 ********** 589 42 ********** 615 42 ********** 641 42 ********** 666 42 ********** 692 42 ********** 717 42 **********

With my arduino and light sensor it looks like this

� G��A���I��Ra!�� G��b�F�!��A���A���H��IA�� M�H��I�� �G��A���IA�IE���I��� G���J���$��E���QM��E���I��IM��A���IM��4��H�� G��A���I��Ra!�� G��b�F�!��A���A���H��IA�� M�H��I�� �G��A���IA�IE���I��� G���J���$��E��!�2�SB��!R)�c�V)�C@��4�S���4�S���"�W���"�R� ��4�V� ��ER� ��GV�!��GC@ ��p� LH��G ��S �$��S� ��4�S� ����R� ����V� �S� ��2�"� �"��7B�"4�7� �"�����#3�!�3� �"4�24�&4�&� �"�����'Ba�3� �2�����64��!�!�"4�&��7B�#� �2�����7Ba�!�3� �2���!�a�!�3B �&4�&� �"��3B �&� �!�7B(��!�7Ba�#� ����!�"��3�!�3� �"4�2� �'��3)�3B�"4�&� �"��2���!�aa�7� �"���!�!�2��!�"4�"��'B �&� ����3Ba�!�3� �"���!�aVa�!�7B �"4�&� �"��"��2�����3Va�&� �2���"� �&��3B(�24�#�7� �"� �"�����7Fa�!�#� �2���!�a�!�3� �24�2� �!�"4�3�'� ������G�!�� M��B�"� �!�7� �"4�2� �� G�!�3� �&���!�� G�!�'B �"4�"� �� M�E�5�"� �3)�7� �"� �!�� M���B�24�&� �� M�3)�e�B�!�'� ��IA���� �(1�3� �� M��!�!�#� ��IA�"� �!�&� ��)�!�� G�F��� M��!���G�!�3B ��IA�&� �� G�!�#B�&4�"� �� G�!�"4�� G���B�6� �!�7� ��!�1��IM��5��I��AM��A��e�J��I�� FH�� G���p��B��A���H�� G��4��A��� G�F� ��H�CE��B��I�� �H��J��I��� M�KE��A���H�� M���$���G��b��H��I��CE�� G��P��I���4`�3 AE���G��A��� G��H�a ��P��B��Ia�CE� �G��A��F�!�� M�Ra!�� G��A���H��I���B�� G� �H� �t��A���I��CM��C��@H���p��b�� M��A���B�CE�� G���P� �H��IA�� "��3)�7B�"4�"� �)�5�"� �"��3B�"��3Va�'� ��!�1�2� �'3�!�3B�"4�&� �"��!�#B �&4�"� �"��!�#Ba�"� �)�5�"��7B(�2��#�#� �&� �!��!�"��7� �"��"� �"��!�#B�"4�&� �"��!�'Ba�&� �)�5�'��3B �2��#B�&� �"��3Ba�1�6� �"��)�3B�"4�#� �"���)�3B�&4�&� �"�����&4�"��b��r4��Ra�f �cB�r��SB�B!�ba4�r��BG��f��GB(�f��w� �B��b �r��BC��F �BC��r��V)�b��WB�r��w� �F)�f� ���v� �BG��b��sB �r �Ba!�c��r4��Ra�B �SB�B!�ba4���F� �BC��b��gB �b��WB �F��f��FG��w� �BG��b��SB(�R��ba4�BC��f �Ba!�b��r4�B!�Ba5�g3�f� �VG��f��CB �B��s� �R)�b��Ra!�r��CB�b��sB�B!�ba4���r��Ba!�b��g� ��Ra�R �Fa!�f��w� �V)�b��CB�r��sBa�F �g� �r��s� �B)�r4�wBa�r �g� �F)�v��f��b��r��B��c� �b��FG��r4�cB�B!�S� �R!�b����b��S� �b �gB�B!�Ba!�g3�f� �w3�V �Ba!�b �SB�R �Ba!�c��g� �VG��b4�wBa�r��wB�F!�w� �F)�b��B��r4��Ra�F!�Ba!�b��Ra5�c�b� �sBa�r� �BC��c��RC��b��g� �B)�C� �BG��f��WB(�v��w� �B��SB �r��sB�f!�Ra5�F��b4�GBa�r��RG��b��gBa�v��WB�b!�BC��c��Ra1�c��F �SB �b��cBa�b �Ra!�c��C� �cB�F!�S� �GBa�b �W� �R��f��wB�f �g��C� �RG��b �Ba!�b��s� ��a�V �Ba!�b��w� �F)�f4�WBa�v��cBa�B��r��sB�F!�CB�F!�ba4�B!�b��RG��b��cB �F �s� �b��Ba!�r��RG��w

What can I do to change this? Thank you in advance

Have you forgotten something?

not that i know, the difference it that the coding is for a microphone. And i'm using a light sensor.

Ah!~ So now we know what it's all about.

Elsa123: not that i know,

Hint: this is the "Programming" section.

sorry i'm very new to this. Do you have any ideas how i can change this?

Nick_Pyner: Ah!~ So now we know what it's all about.

How do you mean? Do you know the answer?

Elsa123: sorry i'm very new to this. Do you have any ideas how i can change this?

No, none at all.

Do you have something you want to show us?


this is the circuit

and this is the code i used which is giving me not the same graph as shown.
#define THRESHOLD (0)
#define MAX_SAMPLES (5)

int top=0;

int samples[MAX_SAMPLES];
int si=0;
int mi=0;
int total=0;

char graph[11] = {
“----------”,
"
---------",
--------",
"
-------",
"
------",
"-----",
"
----",
"
—",
"–",
"
-",
"
******”,
};

void setup() {
Serial.begin(57600);

for(int i=0;i<MAX_SAMPLES;++i) {
samples*=0;*
}
}
void loop() {
int volume=analogRead(0);

  • // average the samples*
    total -= samples[si];
    samples[si] = volume;
    total += samples[si];
    if( mi < MAX_SAMPLES ) mi++;
    si = (si+1) % MAX_SAMPLES;
    int average = total / mi;
  • // remember the loudest sound, for scaling the graph*
    if( top < average ) top = average;
  • // scale the volume from threshold to top, inclusive.*
    int x = 10.0 * (float)(average-THRESHOLD)/(float)(top-THRESHOLD);
    if(x<0) x=0;
    if(x>10) x=10;
  • // print it out*
    Serial.print(millis());
    Serial.print(’\t’);
    Serial.print(top);
    Serial.print(’\t’);
    Serial.println(graph[x]);
    delay(25);
    }
Serial.begin(57600);

And is that the speed the serial monitor is set to?

What happened to the code tags?

the speed is set to 9600. I did'nt change anything in the code, by making use of code tags

the speed is set to 9600.

Problem solved.

THANK YOU