Xbee S2 cannot read API frame data

Hello guys. I am practising with Xbees and I am trying to repeat this guy:
XBee S2–Digital sampling with API frame data | alselectro.
I have followed his guide step by step and when I upload the program to arduino there is no data going to my serial monitor … I am powering my Arduino with PC usb and I am powering my router circuit with another usb cable from my computer. I have been trying to figure out and kept changing and playing with the settings but nothing helps. I am very frustrated! :frowning: I have added some extra code and it seems that LED 13 does not light up that means it never satisfies IF condition. Any ideas how could i troubleshoot this problem?

Any ideas how could i troubleshoot this problem?

Based on your pictures? Not a clue.

Post text AS TEXT!

What is wrong with my pictures? Tell me what are you confused about and I will clarify

Text program

#include <SoftwareSerial.h>
int led =13;

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()
{
Serial.begin(9600);
}
void loop()
{
if (Serial.available()>=21){
digitalWrite(led,HIGH);
for(int i=0;i<22;i++){
Serial.print(Serial.read(),HEX);
Serial.print(",");
}
Serial.println();
}

What is wrong with my pictures? Tell me what are you confused about and I will clarify

I’m not confused. You are. Post text (code IS text) AS TEXT, NOT as pictures.

Post serial monitor output text AS TEXT, NOT as pictures.

void loop()
{
  if (Serial.available()>=21){
    digitalWrite(led,HIGH);
    for(int i=0;i<22;i++){

That code looks like sh*t. ALL curly braces go on new lines OR ALL curly braces go on the line with the function/statement that they go with. Inconsistent curly brace positioning is a sign of poor programming skills and is so easy to avoid.

Instead of waiting for more than 21 characters to arrive, why don’t you just print each one as it arrives? If you see ANY output, you KNOW you got input. Whether that input is what you expect, or not, is irrelevant until you get SOME input.

I can not guess how your XBee is connected to the Arduino, but it appears as though you think it is connected to pins 10 and 11. Although that is just a guess on my part, since the software serial instance name is completely useless crap.

If it IS connected to pins 10 and 11, why do you never read from those pins?

I have remove software serial and now it is working. wow.. That is very frustrating

zazas321:
I have remove software serial and now it is working. wow.. That is very frustrating

If you feel that working code is frustrating you, you can always revert to non-working code. I can't begin to imagine why you'd want to.

I am no doctor but you have some issues :smiley: no idea what makes you so negative but yeah :smiley: just to let you know maybe try to be more polite next time :smiley: