serial monitor not printing

i wrote this code in order to receive the input from my RC transmitter…but however when i try to read the values i cannot read the values…!! :frowning:
void setup()
{
pinMode(0,INPUT);
pinMode(1,INPUT);
pinMode(2,INPUT);
pinMode(3,INPUT);
pinMode(4,INPUT);
pinMode(5,INPUT);
Serial.begin(115200);
}
void loop()
{
int a[6];
for(int i=2;i<8;i++)
{
a*=pulseIn(i, HIGH,1200000);*

  • }*
  • delay(2000);*
  • Serial.println(“ch 1:”+a[0]);*
  • Serial.println(“ch 2:”+a[1]);*
  • Serial.println(“ch 3:”+a[2]);*
  • Serial.println(“ch 4:”+a[3]);*
  • Serial.println(“ch 5:”+a[4]);*
  • Serial.println(“ch 6:”+a[5]);*
    }
    i get the output as
    ?êYÃ+m¡?W­Z®¨?-ÞMüçÿr¨AÝû­Ü{??R
    *²ý¾?ú?}áû||¯ÿ?Û¶ü¿?}©µÿ"ô»=­ö;¬¤?Óãâüü}e9ëÓë©ÿïüNöYsý½¼wAç5å?n<??^73ïó¡È<ifYÛ7°õqÏij~þþ?Ó5ÿÛæא×ç}º* *º z?Ì5­é{áÿ¶eK÷]KO¿ÑG¹Y???Ä* *as»Ä#?Ï?* *8öím­÷]Oÿ<ª?|íoÜÑñ?5¸ûéO?â²G?ÊL¶åìêÐþ®ú³¡ý2¯ÐΫßû5^ßAWïXDµÞÕ?5jéÝ¿ ʯo?÷µ?¶ÏKÿn˲¨ÑÕ©Oü°7Íоßþ÷oZ¿?ÓÛlãíåz»}ü¹?û÷n©ÙÏïé<Ïÿ??®?ÛM?­%ÝÍÛÙ~öîÎx+Úþå¿Eédy?´¿[¬è;* *þʹÆÿVmQ×ï?qÔVv»µ?G¡<˝þå?[¯rñÿˬ?£Ø4ad{mª²¾t®¿¥ÿßb½v÷uÅÔÛ®c?¹?q¶äïl?7³Ñ?­5O¯* *?½bv-SßôÎz?l®øù'Z?úyΫ§®IÂcí½D¿Ù½zêÄómÍÇm·6Ö?>:⡯Á4??÷aÛ* <em>¬­w_õÍiûÍØ1!,¹.ro÷ù?¿ú}!¯þ1èÞÊÿnÿ¶aýþ½!ïÕshLÃ?çú?ø?ÛüÏÝç>îã<b¦á·´Z~ïèÿ÷è. ¬«æÃ?9·|µÈ3ìûÕ;=@û¬¢âß?û¼ª??\ÿÇÛ>Ëxÿq8³à6\Þfê?ïúÛ?ý?ÎRôí)ª??Úã÷ U¯Øv???w_®#KévÓ®e¯ï£å¼cW®îé7?¾¸ý?²? ñ]ø~:?Åë_)þ¶æ« ð?g}-Ka?ø???å×ï¥y;½~k?ïs§)¥ò???ÇíçèïfGüÞ¶ûýûúãɶI%ûû¸yú=í¦nÞ?wéÙ÷ÿçý¶Øéîý»Ïbi7GßG;üuÆð¼¿ohÒ?ã}/mþ?¤¾¸OWK~þêÿÿÇì?gÑ|j;«'½ùmö?«VݯÖÓëN#ö7þ¾ô[ÖýµÑr7gÈâçýð>D(ÒÃoÞeng©g?!gõî}ÏM_ÈüÚƽ{ö?¼õ©úqùýJÿÚûÀÞKÝ?;qwùíaótæþr¿_ÿ]Ææ ûgç7ÓGÝ´ª?×þ÷Ü®WÏ2·íõÝâ??µïoÞû®¦®ðÓ­?o)ÔAQÕ¡³Ýì?_µ÷XùÈ×Ùü3ÙzNko¹9aCZýßhÞöÄëB}<Ùò;ý;üz;û²µz??NЏÝa½=Àçüx³ïÏâ5ÓÍÿ?Û°»,à´?výÿUù??þîFzòë÷?ô§û/Oý¼½ìþ{·ÿ*ôþÝϵ·yö?úúè3jÁÙ­yº4ïD?ù?Qkâ?];xa?þþÏ»í­2,véíã?ôçúÂ{ýó?Búw~ðî·ßÿۏn£Íé©?R+;sx?å´´?ÃsُÛÛî×þHrìyqÙq?ÛOâsÜÙÖ÷"§cRzweÕ?ýUè·|UýÖõ§õ©Z£z?-âzÂUô«½?êî]ugÁ»û?¶}ªo~·º×úÏóß??e¶9?D¶Û|ÿneµß?ÕÉÆnÕ?ß®(¯÷ý±ÇýµÛ³ûíÇ}FîËý×éfiÞû?½m>ÿ>ó?ñáÍ»ë?È®Á-?Rõsö]üö[?¶,ÜñÛu÷뼿,ãþ+üËÍÝ;´ùZ’k®KéïñöûnþíÂð?ó?Mÿ{f?Yöç?ÏåÎÖ5ï£[õµÖe>ÍxÓKòúØ (×/§Y?ÏInkëP’°ð­­½_ìtxRa_3?pk $iY·En¤Ú«{O¶?ëµ³ðîÏ?v߯?Ýüò÷heÝ>1ð(EsK¿Ó¹Þñ·Åÿ:?ý·Õâ~TÈ?7Y>??Uá¾[¿oSða{zvÿªs»ßs?×þ~^=¾}9îm?ü-/ÿÍȶÿ?¯zQ½Î¹?Ý¿üâoäØ?ïÏ1ðòyÓ/tõ5ÿþÕsÜw?J¦??5§\¼J^£Ù?¼þ??Ù·sõ¯öìþ\öÛ~³o{9_ïϯÙÍ\z?_fß_Ìu)2íwÏ /Láß?ì®aµõ{5¿}?v­ÿ¿g?Û¾µÏâÿ/¸Í¬!zúLk±?êÐö|Q®sc¿.|ü»Çÿ?|Ãú??Wl?õ ïÙ?p8°c
    Åki§û?ý¾? Ï©õÝ¿Ç?7I?êYÃ+m¡?W­Z®¨?-ÞMüçÿr¨AÝû­Ü{??R
    ²ý¾?ú?}áû||¯ÿ?Û¶ü¿?}©µÿ"ô»=­ö;¬¤?Óãâüü}e9ëÓë©ÿïüNöYsý½¼wAç5å?n<??^73ïó¡È<ifYÛ7°õqÏij~þþ?Ó5ÿÛæא`×ç}º
    º z?Ì5­é{áÿ¶eK÷]KO¿ÑG¹Y???Ä
    as»Ä#?Ï?
    8öím­÷]Oÿ<ª?|íoÜÑñ?5¸ûéO?â²G?ÊL¶åìêÐþ®ú³¡ý2¯ÐΫßû5^ßAWïXDµÞÕ?5jéÝ¿ ʯo?÷µ?¶ÏKÿn˲¨ÑÕ©Oü°7Íоßþ÷oZ¿?ÓÛlãíåz»}ü¹?û÷n©ÙÏïé<Ïÿ??®?ÛM?­%ÝÍÛÙ~öîÎx+Úþå¿Eédy?´¿[¬è;
    þʹÆÿVmQ×ï?qÔVv»µ?G¡<˝þå?[¯rñÿˬ?£Ø4ad{mª²¾t®¿¥ÿßb½v÷uÅÔÛ®c?¹?q¶äïl?7³Ñ?­5O¯
    ?½bv-SßôÎz?l®øù’Z?úyΫ§®IÂcí½D¿Ù½zêÄómÍÇm·6Ö?>:⡯Á4??÷aÛ
    g}-Ka?ø???å×ï¥y;½~k?ïs§)¥ò???ÇíçèïfGüÞ¶ûýûúãɶI%ûû¸yú=í¦nÞ?wéÙ÷ÿçý¶Øéîý»Ïbi7GßG;üuÆð¼¿ohÒ?ã}/mþ?¤¾¸OWK~þêÿÿÇì?gÑ|j;«'½ùmö?«VݯÖÓëN#ö7þ¾ô[ÖýµÑr7gÈâçýð>D(ÒÃoÞeng©g?!gõî}ÏM_ÈüÚƽ{ö?¼õ©úqùýJÿÚûÀÞKÝ?;qwùíaótæþr¿_ÿ]Ææ ûgç7ÓGÝ´ª?×þ÷Ü®WÏ2·íõÝâ??µïoÞû®¦®ðÓ­?o)ÔAQÕ¡³Ýì?_µ÷XùÈ×Ùü3ÙzNko¹9aCZýßhÞöÄëB}<Ùò;ý;_üz;û²µz?
  pinMode(0,INPUT);
  pinMode(1,INPUT);

Which type of Arduino are you using? On the Uno (and some others, I think) pins 0 and 1 are connected to the serial monitor port, so you can’t use them for other purposes. Try moving those two connections to other pins.

Is your speed on the serial monitor set correctly?
Serial.begin(115200);

When do you actually read the data?
Typically one uses things like:

if (Serial.available() >5){  // 6 bytes received?
//read 6 bytes
a[0] = Serial.read();
a[1] = Serial.read();
a[2] = Serial.read();
a[3] = Serial.read();
a[4] = Serial.read();
a[5] = Serial.read();

and mix in your pulse code as needed.

i am using UNO only i have even changed the pin connections…if figured it and tried it still it is not working i have set the baud rate also correctly 115200 .

i am reading the PPM signals from the RC receiver i use transmitter to give my input signal.i am not using my serial communication to give the input.

Basic test: add a print statement after Serial.begin()

Serial.begin(115200);
Serial.println("program started");

Can you see "program started" on the serial monitor before the strange output?

Yeah its gettin printed…!!but only when i want to display my input value it is printing such strange symbols,…!!

OK, so baud rate OK.

Try changing your print statements in loop() into two statements:

// Serial.println("ch 1:"+a[0]);
Serial.print("ch 1: ");
Serial.println(a[0]);

Ah - you need this
a[i-2]=pulseIn(i, HIGH,1200000);
you're missing the array reference.
[i-2] because you declare the array as 6 bytes, a[0] to a[5], but your loop is from 2 to7.

this would be my code

for(int i=2;i<8;i++)
{
a*=pulseIn(i,HIGH,1200000);*
}[/color]
which means a[2] will hold my first channel 1 input based on my connections…!!

@hack scribble

ill try that and let you know bro..!!thankyou for your reply :slight_smile:

int a[6]; <<< this declares space in memory for a[0], a[1], a[2], a[3], a[4], a[5]
for(int i=2;i<8;i++)
{
a=pulseIn(i, HIGH,1200000); <<< this needs to be a[i-2] to store into a[0], a[1], a[2], a[3], a[4], a[5]
}
so you can then print them:
Serial.println(“ch 1:”+a[0]);
Serial.println(“ch 2:”+a[1]);
Serial.println(“ch 3:”+a[2]);
Serial.println(“ch 4:”+a[3]);
Serial.println(“ch 5:”+a[4]);
Serial.println(“ch 6:”+a[5]);