serial.available() not work

Hi,
I have a problem with arduino nano. I would like to communicate with an arduino nano module 433 mhz but I can not make the port of communication open.
I always get that (! Serial.available ()).

void setup(){

Serial.begin(9600);
Serial.print("after 9600\n");
delay(1000);
}
void loop(){
Serial.print("loop\n");
delay(1000);
while(Serial.available()){
Serial.print("available\n");
delay(1000);
}
if(!Serial.available()){
Serial.print("not available\n");
delay(1000);
}
}

this is the output:

after 9600
loop
not available
loop
not available
loop
not available
loop
not available
loop
not available
loop
not available

help me

What serial port is the "433 MHz" on?

Serial is being used to send data to the serial monitor. You cannot share the Serial port on the arduino, you probably need software serial.

I would like to connect up to 2 modules through the pins tx rx what should I use?

 if(!Serial.available()){
    Serial.print("not available\n");
    delay(1000);
  }

available returns an int of one size or another, why do you thing you can use ! on it What do you think you will get?

Mark

peppegti:
I would like to connect up to 2 modules through the pins tx rx what should I use?

Depends on the module.

I have to connect two modules via arduino nano 2 radio modules.
Arduino A ---> Radio A )))))))))))))(((((((((((((( Radio B <---Arduino B
the radio module is connected to gnd rx tx 3v3 with Arduino
I want to press a button on the Arduino to turn on an LED on Arduino and B

peppegti:
I have to connect two modules via arduino nano 2 radio modules.
Arduino A ---> Radio A )))))))))))))(((((((((((((( Radio B <---Arduino B
the radio module is connected to gnd rx tx 3v3 with Arduino
I want to press a button on the Arduino to turn on an LED on Arduino and B

First get your project working without the radio, just use wires between the arduins tx/rx/gnd pins. when that is working, then add the radios.

I want to press a button on the Arduino to turn on an LED on Arduino and B

Sorry

I want to press a button on the Arduino A to turn on an LED on Arduino B

Below is some arduino to arduino test code that uses wire between the arduinos. If this works, then try the code with the radios instead of wires.

//zoomkat 3-5-12 simple delimited ',' string tx/rx 
//from serial port input (via serial monitor)
//and print result out serial port
//Connect the sending arduino rx pin to the receiving arduino rx pin. 
//Connect the arduino grounds together. 
//What is sent to the tx arduino is received on the rx arduino.
//Open serial monitor on both arduinos to test

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("serial delimit test 1.0"); // so I can keep track of what is loaded
}

void loop() {

  //expect a string like wer,qwe rty,123 456,hyre kjhg,
  //or like hello world,who are you?,bye!,

  if (Serial.available())  {
    char c = Serial.read();  //gets one byte from serial buffer
    if (c == ',') {
      if (readString.length() >1) {
        Serial.print(readString); //prints string to serial port out
        Serial.println(','); //prints delimiting ","
        //do stuff with the captured readString 
        readString=""; //clears variable for new input
      }
    }  
    else {     
      readString += c; //makes the string readString
    }
  }
}

holmes4:

 if(!Serial.available()){

Serial.print("not available\n");
   delay(1000);
 }




available returns an int of one size or another, why do you thing you can use ! on it What do you think you will get?

Mark

Trying hard to see the point you're making.
Failing.

You are using rx and tx for programming and the serial monitor. Use SoftwareSerial and two other pins.

can you send me example?

thanks
but you can send me example for the module 433?

If you're using a bare 433MHz module, you're better off using VirtualWire.

You need another serial port. You can't use the same serial port for printing out to the PC and sending it to the radio. :~

xmart:
You need another serial port. You can't use the same serial port for printing out to the PC and sending it to the radio. :~

You sure about that? I send serial data from an arduino to another arduino and the serial monitor on the arduino hardware serial port.

For virtualwire use 1 pin data
But I have in the module tx and rx

This is the system
Arduino nano
Module radio aurel xt7020
Distance 100 mt
...please help me

...please help me

Did you try connecting the two arduinos together just using some short wires instead of the radio modules? If so, what was received on the receiving arduino?