pulsiIn() and tone

hi!
I've a problem with the usage of pulseIn() with the function tone. I receive anything.
I shlould receive a high pulse from another file that is seems to this.

#define SENSING 7
#define IR 13

unsigned long sense;
void setup(){
pinMode(SENSING,INPUT);
pinMode(IR,OUTPUT);
Serial.begin(115200);

}
void loop(){

invioTono();

sense=pulseIn(SENSING,LOW);
leggoACK(sense);

//sense=pulseIn(SENSING,LOW);
//Serial.println((sense/1000));

}

void invioTono()
{

tone(IR,38000);
delay(17);
noTone(IR);
delay(50);

}

void leggoACK(unsigned long x)
{
if(((x/1000)<=15) && ((x/1000)>=10))
Serial.println("ACK");
else
Serial.println(x/1000);
}

I've a problem with the usage of pulseIn() with the function tone.

You're not going to tell us what the problem is?

I shlould receive a high pulse from another file

This makes no sense. A file can not generate a HIGH pulse.

ok! I'm sorry!

It is not "from another file" but from another Arduino Uno Board on another pc.
These are the correct ".ino files"
thnk's.

FIRST CODE

#define LED 13
#define SENSING 7
long sense;

void setup(){
pinMode(SENSING, INPUT);
pinMode(LED,OUTPUT);
Serial.begin(115200);

}

void loop(){

sense=pulseIn(SENSING,LOW);

if((sense/1000)<=55 && (sense/1000)>=45){

Serial.println(sense/1000);

tone(LED,38000);
delay(5);
noTone(LED);
delay(5);
}
else{
Serial.print("NON RICEVO NULLA----->");
Serial.print((sense/1000));
Serial.print("\n");
}

}


SECOND CODE

#define LED 13
#define SENSING 7
long sense;

void setup(){
pinMode(SENSING, INPUT);
pinMode(LED,OUTPUT);
Serial.begin(115200);

}

void loop(){

tone(LED,38000);
delay(50);
noTone(LED);

sense=pulseIn(SENSING,LOW);

if((sense/1000)<=3 && (sense/1000)>=7){

Serial.println(sense/1000);
Serial.println("IMPULSO TRASMESSO E RICEVUTO");

}

}

Still no explanation of what the problem is.

Good luck solving it.

Here are some more questions:

  1. Why did you write the code?
  2. What is it supposed to do?
  3. Why are you using 2 Arduino boards?
  4. Why are you using tone() to generate 38000 Hz? It is used for audio tones. 38000 is far beyond human hearing.
  5. What is connected to pin 7?
  6. Why are you using the led on pin 13?

Hi, while we wait for a better explanation of your problem, if i understand what u want to do u can change this
tone(pin, frequency, duration)

zetax:

      tone(LED,38000);

delay(5);
      noTone(LED);
      delay(5);

tone(Led, 38000, 5)
as reference say: "Generates a square wave of the specified frequency (and 50% duty cycle) on a pin" is that u want? u want a square wave with 50% duty cicle?