Arduino Mega nRF24l01+ programming problem

Hello,
I am trying to replicate the project from the link below:
http://www.webondevices.com/arduino-robot-car-obstacle-avoidance/

The problem which I have is that I am using an Arduino Nano for the car and it seems that I cannot connect the remote control to the car. If I do the Hello World example to check the comunication it works fine when I set the voltage selector on the joystick shield on the 3.3 V. On the 5 volts position it does not work. I tried the program form the website with 3.3v set but again, the TX led on the Arduino Mega does not light up like when is working with the Hello world example.
Do you have any ideas? It is a little urgent this topic.
Thank you very much and have a nice day!

I had to add some whitespace to your text to separate out the different thoughts before I could make any sense of it.

The problem which I have is that I am using an Arduino Nano for the car and it seems that I cannot connect the remote control to the car.

If I do the Hello World example to check the comunication it works fine when I set the voltage selector on the joystick shield on the 3.3 V.

On the 5 volts position it does not work.

I tried the program form the website with 3.3v set but again, the TX led on the Arduino Mega does not light up like when is working with the Hello world example.

Do you have any ideas? It is a little urgent this topic.

Thank you very much and have a nice day!

Even then I can't make out what is your problem with a Mega.

What does the Nano do?
What do you mean by "the remote control"?
What is the "Hello World example"?

Post the pair of programs that communicate properly and also post the pair of programs that do not work.

I presume you are aware that the MISO, MOSI and SCLK pins are in a different place on a Mega?

...R
Simple nRF24L01+ Tutorial

Hello,

So the codes are below,

The transmitter:

#include <SPI.h>
#include <RF24.h>
#include <RF24_config.h>

// Radio pin setup
#define cePin 9
#define csnPin 10

#define joyX A0
#define joyY A1

// Init RF24 radio
RF24 radio(cePin, csnPin);
const uint64_t pipe0 = 0xF0F0F0AA;
uint8_t p0 = 0;

// Variables
int chr[1];
int terminateChar[1];
String dataToSend = "";

void setup() {
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipe0);
}

void loop() {
dataToSend += map(analogRead(joyX), 0, 1023, 0, 9);
dataToSend += map(analogRead(joyY), 0, 1023, 0, 9);
int stringSize = dataToSend.length();
for (int i = 0; i < stringSize; i++) {
int charToSend[1];
charToSend[0] = dataToSend.charAt(i);
radio.write(charToSend,1);
}
terminateChar[0] = 2;
radio.write(terminateChar, 1);
dataToSend = "";
}

The receiver:

#include <SPI.h>
#include <RF24.h>
#include <RF24_config.h>

// Radio pin setup
#define cePin 9
#define csnPin 10

// US sensor pin setup
#define trigPin 14
#define echoPin 2
#define accuracy 4

// Motor pin setup
#define enableLeft 6
#define leftForward 4
#define leftBackward 3

#define enableRight 5
#define rightForward 8
#define rightBackward 7

// Init RF24 radio
RF24 radio(cePin, csnPin);
const uint64_t pipe0 = 0xF0F0F0AA;
uint8_t p0 = 0;

// Variables
String receivedMessage = "";
int chr[1];
int joyX = 4;
int joyY = 4;
int speedCoeff = 0;
int left = 0;
int right = 0;

void setup(){
// Setup RF24 radio
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(p0, pipe0);
radio.startListening();

// Setup US sensor
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);

// Setup LEFT whel
pinMode(enableLeft, OUTPUT);
analogWrite(enableLeft, 255);

pinMode(leftForward, OUTPUT);
digitalWrite(leftForward, LOW);

pinMode(leftBackward, OUTPUT);
digitalWrite(leftBackward, LOW);

// Setup RIGHT wheel
pinMode(enableRight, OUTPUT);
analogWrite(enableRight, 255);

pinMode(rightForward, OUTPUT);
digitalWrite(rightForward, LOW);

pinMode(rightBackward, OUTPUT);
digitalWrite(rightBackward, LOW);
}

void loop(){
// Get Distance sensor
float duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10); // Added this line
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration / 2) / 29.1;

// Watch control messages
while(radio.available()){
radio.read(chr, 1);
char receivedChar = chr[0];

if (chr[0] != 2){
receivedMessage.concat(receivedChar);
} else {
joyX = receivedMessage.substring(0,1).toInt();
joyY = receivedMessage.substring(1,2).toInt();

if(distance < 15){
joyX = 4;
joyY = 4;
}

if(joyY < 4){
// Backward
digitalWrite(rightBackward, HIGH);
digitalWrite(rightForward, LOW);
digitalWrite(leftBackward, HIGH);
digitalWrite(leftForward, LOW);
speedCoeff = map(joyY, 0, 4, 255, 0);
speedCoeff = speedCoeff < 0 ? 0 : speedCoeff;
speedCoeff = speedCoeff > 255 ? 255 : speedCoeff;
} else if(joyY > 4){
// Forward
digitalWrite(rightBackward, LOW);
digitalWrite(rightForward, HIGH);
digitalWrite(leftBackward, LOW);
digitalWrite(leftForward, HIGH);
speedCoeff = map(joyY, 4, 9, 0, 255);
speedCoeff = speedCoeff < 0 ? 0 : speedCoeff;
speedCoeff = speedCoeff > 255 ? 255 : speedCoeff;
}

right = map(joyX, 4, 9, 255, 0);
right = right < 0 ? 0 : right;
right = right > 255 ? 255 : right;

right = (right + speedCoeff) / 2;
analogWrite(enableRight, right);

left = map(joyX, 0, 4, 0, 255);
left = left < 0 ? 0 : left;
left = left > 255 ? 255 : left;

left = (left + speedCoeff) / 2;
analogWrite(enableLeft, left);

if(joyY == 4){
// Stopped
if(joyX < 4){
// Left
digitalWrite(rightBackward, LOW);
digitalWrite(rightForward, HIGH);
digitalWrite(leftBackward, HIGH);
digitalWrite(leftForward, LOW);

right = map(joyX, 0, 4, 255, 0);
right = right < 0 ? 0 : right;
right = right > 255 ? 255 : right;
analogWrite(enableRight, right);

left = map(joyX, 0, 4, 255, 0);
left = left < 0 ? 0 : left;
left = left > 255 ? 255 : left;
analogWrite(enableLeft, left);

} else if(joyX > 4){
// Right
digitalWrite(rightBackward, HIGH);
digitalWrite(rightForward, LOW);
digitalWrite(leftBackward, LOW);
digitalWrite(leftForward, HIGH);

right = map(joyX, 4, 9, 0, 255);
right = right < 0 ? 0 : right;
right = right > 255 ? 255 : right;
analogWrite(enableRight, right);

left = map(joyX, 4, 9, 0, 255);
left = left < 0 ? 0 : left;
left = left > 255 ? 255 : left;
analogWrite(enableLeft, left);

} else if (joyX == 4){
// Stopped
digitalWrite(rightBackward, LOW);
digitalWrite(rightForward, LOW);
digitalWrite(leftBackward, LOW);
digitalWrite(leftForward, LOW);
analogWrite(enableRight, 0);
analogWrite(enableLeft, 0);
}
}
receivedMessage = "";
}
}
}

The Hello World exercise is below

http://starter-kit.nettigo.eu/2014/connecting-and-programming-nrf24l01-with-arduino-and-other-boards/

I have replaced the Arduino Nano from the example with an Arduino Mega, I am powering the receiver module from a separate 3.3 v source so I cannot see to find the problem. The connection is working, but not with the code from up. I am aware that the pins are different on the Mega.
I have done the tutorial also. It works. The problem is when I put the code for the Transmitter and Receiver from webondevice I do not have communication. I have checked everything.

Thank you!

To make it easy for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

Your code is too long for me to study quickly without copying to a text editor.

Which program is on the Nano and which is on the Mega?

Also, please post the HelloWorld code here. Help us to help you.

...R

Hello,
SO I have checked everything and also the tutorials from here:
http://forum.arduino.cc/index.php?topic=421081

Everything works. I changed nothing, just upload the code for the transmitter:

#include <SPI.h>
#include <RF24.h>
#include <RF24_config.h>

// Radio pin setup
#define cePin 9
#define csnPin 10

#define joyX A0
#define joyY A1

// Init RF24 radio
RF24 radio(cePin, csnPin);
const uint64_t pipe0 = 0xF0F0F0AA;
uint8_t p0 = 0;

// Variables
int chr[1];
int terminateChar[1];
String dataToSend = "";

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(pipe0);
}

void loop() {
    dataToSend += map(analogRead(joyX), 0, 1023, 0, 9);
    dataToSend += map(analogRead(joyY), 0, 1023, 0, 9);
    int stringSize = dataToSend.length();
    for (int i = 0; i < stringSize; i++) {
      int charToSend[1];
      charToSend[0] = dataToSend.charAt(i);
      radio.write(charToSend,1);
    }
    terminateChar[0] = 2;
    radio.write(terminateChar, 1);
    dataToSend = "";
}

and for the receiver:

#include <SPI.h>
#include <RF24.h>
#include <RF24_config.h>

// Radio pin setup
#define cePin 9
#define csnPin 10

// US sensor pin setup
#define trigPin 14
#define echoPin 2
#define accuracy 4

// Motor pin setup
#define enableLeft 6
#define leftForward 4
#define leftBackward 3

#define enableRight 5
#define rightForward 8
#define rightBackward 7

// Init RF24 radio
RF24 radio(cePin, csnPin);
const uint64_t pipe0 = 0xF0F0F0AA;
uint8_t p0 = 0;

// Variables
String receivedMessage = "";
int chr[1];
int joyX = 4;
int joyY = 4;
int speedCoeff = 0;
int left = 0;
int right = 0;

void setup(){
  // Setup RF24 radio
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(p0, pipe0);
  radio.startListening();

  // Setup US sensor
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);

  // Setup LEFT whel
  pinMode(enableLeft, OUTPUT);
  analogWrite(enableLeft, 255);

  pinMode(leftForward, OUTPUT);
  digitalWrite(leftForward, LOW);

  pinMode(leftBackward, OUTPUT);
  digitalWrite(leftBackward, LOW);

  // Setup RIGHT wheel
  pinMode(enableRight, OUTPUT);
  analogWrite(enableRight, 255);

  pinMode(rightForward, OUTPUT);
  digitalWrite(rightForward, LOW);

  pinMode(rightBackward, OUTPUT);
  digitalWrite(rightBackward, LOW);
}

void loop(){
  // Get Distance sensor
  float duration, distance;
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10); // Added this line
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration / 2) / 29.1;

  // Watch control messages
  while(radio.available()){
    radio.read(chr, 1);
    char receivedChar = chr[0];

    if (chr[0] != 2){
      receivedMessage.concat(receivedChar);
    } else {
      joyX = receivedMessage.substring(0,1).toInt();
      joyY = receivedMessage.substring(1,2).toInt();

      if(distance < 15){
        joyX = 4;
        joyY = 4;
      }

      if(joyY < 4){
        // Backward
        digitalWrite(rightBackward, HIGH);
        digitalWrite(rightForward, LOW);
        digitalWrite(leftBackward, HIGH);
        digitalWrite(leftForward, LOW);
        speedCoeff = map(joyY, 0, 4, 255, 0);
        speedCoeff = speedCoeff < 0 ? 0 : speedCoeff;
        speedCoeff = speedCoeff > 255 ? 255 : speedCoeff;
      } else if(joyY > 4){
        // Forward
        digitalWrite(rightBackward, LOW);
        digitalWrite(rightForward, HIGH);
        digitalWrite(leftBackward, LOW);
        digitalWrite(leftForward, HIGH);
        speedCoeff = map(joyY, 4, 9, 0, 255);
        speedCoeff = speedCoeff < 0 ? 0 : speedCoeff;
        speedCoeff = speedCoeff > 255 ? 255 : speedCoeff;
      }

      right = map(joyX, 4, 9, 255, 0);
      right = right < 0 ? 0 : right;
      right = right > 255 ? 255 : right;

      right = (right + speedCoeff) / 2;
      analogWrite(enableRight, right);

      left = map(joyX, 0, 4, 0, 255);
      left = left < 0 ? 0 : left;
      left = left > 255 ? 255 : left;

      left = (left + speedCoeff) / 2;
      analogWrite(enableLeft, left);

      if(joyY == 4){
        // Stopped
        if(joyX < 4){
          // Left
          digitalWrite(rightBackward, LOW);
          digitalWrite(rightForward, HIGH);
          digitalWrite(leftBackward, HIGH);
          digitalWrite(leftForward, LOW);

          right = map(joyX, 0, 4, 255, 0);
          right = right < 0 ? 0 : right;
          right = right > 255 ? 255 : right;
          analogWrite(enableRight, right);

          left = map(joyX, 0, 4, 255, 0);
          left = left < 0 ? 0 : left;
          left = left > 255 ? 255 : left;
          analogWrite(enableLeft, left);

        } else if(joyX > 4){
          // Right
          digitalWrite(rightBackward, HIGH);
          digitalWrite(rightForward, LOW);
          digitalWrite(leftBackward, LOW);
          digitalWrite(leftForward, HIGH);

          right = map(joyX, 4, 9, 0, 255);
          right = right < 0 ? 0 : right;
          right = right > 255 ? 255 : right;
          analogWrite(enableRight, right);

          left = map(joyX, 4, 9, 0, 255);
          left = left < 0 ? 0 : left;
          left = left > 255 ? 255 : left;
          analogWrite(enableLeft, left);

        } else if (joyX == 4){
          // Stopped
          digitalWrite(rightBackward, LOW);
          digitalWrite(rightForward, LOW);
          digitalWrite(leftBackward, LOW);
          digitalWrite(leftForward, LOW);
          analogWrite(enableRight, 0);
          analogWrite(enableLeft, 0);
        }
      }
      receivedMessage = "";
    }
  }
}

and it does not work. The tx led is not on, I have also tried with serial print on the receiver to see if it is getting something, but nothing.
Do you have any idea?
Thanks!

vlad00000:
Everything works. I changed nothing, just upload the code for the transmitter:

[....]

and it does not work.

I don't understand. You say "everything works" and then you say "it does not work"

What works and what does not work?

Post the pair of programs that YOU have uploaded and which DO work

AND

Post the pair of programs that YOU have uploaded and which DO NOT work.

...R

The working programs:

Transmitter:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9, 10);

const byte rxAddr[6] = "00001";

void setup()
{
  radio.begin();
  radio.setRetries(15, 15);
  radio.openWritingPipe(rxAddr);
  
  radio.stopListening();
}

void loop()
{
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));
  
  delay(1000);
}

Receiver:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(34, 39);

const byte rxAddr[6] = "00001";

void setup()
{
  while (!Serial);
  Serial.begin(9600);
  
  radio.begin();
  radio.openReadingPipe(0, rxAddr);
  
  radio.startListening();
}

void loop()
{
  if (radio.available())
  {
    char text[32] = {0};
    radio.read(&text, sizeof(text));
    
    Serial.println(text);
  }
}

Does NOT work:

Transmitter

#include <SPI.h>
#include <RF24.h>
#include <RF24_config.h>

// Radio pin setup
#define cePin 9
#define csnPin 10

#define joyX A0
#define joyY A1

// Init RF24 radio
RF24 radio(cePin, csnPin);
const uint64_t pipe0 = 0xF0F0F0AA;
uint8_t p0 = 0;

// Variables
int chr[1];
int terminateChar[1];
String dataToSend = "";

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(pipe0);
}

void loop() {
    dataToSend += map(analogRead(joyX), 0, 1023, 0, 9);
    dataToSend += map(analogRead(joyY), 0, 1023, 0, 9);
    int stringSize = dataToSend.length();
    for (int i = 0; i < stringSize; i++) {
      int charToSend[1];
      charToSend[0] = dataToSend.charAt(i);
      radio.write(charToSend,1);
    }
    terminateChar[0] = 2;
    radio.write(terminateChar, 1);
    dataToSend = "";
}

Receiver:

#include <SPI.h>
#include <RF24.h>
#include <RF24_config.h>

// Radio pin setup
#define cePin 34
#define csnPin 39

// US sensor pin setup
#define trigPin 14
#define echoPin 2
#define accuracy 4

// Motor pin setup
#define enableLeft 6
#define leftForward 4
#define leftBackward 3

#define enableRight 5
#define rightForward 8
#define rightBackward 7

// Init RF24 radio
RF24 radio(cePin, csnPin);
const uint64_t pipe0 = 0xF0F0F0AA;
uint8_t p0 = 0;

// Variables
String receivedMessage = "";
int chr[1];
int joyX = 4;
int joyY = 4;
int speedCoeff = 0;
int left = 0;
int right = 0;

void setup(){
  // Setup RF24 radio
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(p0, pipe0);
  radio.startListening();

  // Setup US sensor
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);

  // Setup LEFT whel
  pinMode(enableLeft, OUTPUT);
  analogWrite(enableLeft, 255);

  pinMode(leftForward, OUTPUT);
  digitalWrite(leftForward, LOW);

  pinMode(leftBackward, OUTPUT);
  digitalWrite(leftBackward, LOW);

  // Setup RIGHT wheel
  pinMode(enableRight, OUTPUT);
  analogWrite(enableRight, 255);

  pinMode(rightForward, OUTPUT);
  digitalWrite(rightForward, LOW);

  pinMode(rightBackward, OUTPUT);
  digitalWrite(rightBackward, LOW);
}

void loop(){
  // Get Distance sensor
  float duration, distance;
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10); // Added this line
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration / 2) / 29.1;

  // Watch control messages
  while(radio.available()){
    radio.read(chr, 1);
    char receivedChar = chr[0];

    if (chr[0] != 2){
      receivedMessage.concat(receivedChar);
    } else {
      joyX = receivedMessage.substring(0,1).toInt();
      joyY = receivedMessage.substring(1,2).toInt();

      if(distance < 15){
        joyX = 4;
        joyY = 4;
      }

      if(joyY < 4){
        // Backward
        digitalWrite(rightBackward, HIGH);
        digitalWrite(rightForward, LOW);
        digitalWrite(leftBackward, HIGH);
        digitalWrite(leftForward, LOW);
        speedCoeff = map(joyY, 0, 4, 255, 0);
        speedCoeff = speedCoeff < 0 ? 0 : speedCoeff;
        speedCoeff = speedCoeff > 255 ? 255 : speedCoeff;
      } else if(joyY > 4){
        // Forward
        digitalWrite(rightBackward, LOW);
        digitalWrite(rightForward, HIGH);
        digitalWrite(leftBackward, LOW);
        digitalWrite(leftForward, HIGH);
        speedCoeff = map(joyY, 4, 9, 0, 255);
        speedCoeff = speedCoeff < 0 ? 0 : speedCoeff;
        speedCoeff = speedCoeff > 255 ? 255 : speedCoeff;
      }

      right = map(joyX, 4, 9, 255, 0);
      right = right < 0 ? 0 : right;
      right = right > 255 ? 255 : right;

      right = (right + speedCoeff) / 2;
      analogWrite(enableRight, right);

      left = map(joyX, 0, 4, 0, 255);
      left = left < 0 ? 0 : left;
      left = left > 255 ? 255 : left;

      left = (left + speedCoeff) / 2;
      analogWrite(enableLeft, left);

      if(joyY == 4){
        // Stopped
        if(joyX < 4){
          // Left
          digitalWrite(rightBackward, LOW);
          digitalWrite(rightForward, HIGH);
          digitalWrite(leftBackward, HIGH);
          digitalWrite(leftForward, LOW);

          right = map(joyX, 0, 4, 255, 0);
          right = right < 0 ? 0 : right;
          right = right > 255 ? 255 : right;
          analogWrite(enableRight, right);

          left = map(joyX, 0, 4, 255, 0);
          left = left < 0 ? 0 : left;
          left = left > 255 ? 255 : left;
          analogWrite(enableLeft, left);

        } else if(joyX > 4){
          // Right
          digitalWrite(rightBackward, HIGH);
          digitalWrite(rightForward, LOW);
          digitalWrite(leftBackward, LOW);
          digitalWrite(leftForward, HIGH);

          right = map(joyX, 4, 9, 0, 255);
          right = right < 0 ? 0 : right;
          right = right > 255 ? 255 : right;
          analogWrite(enableRight, right);

          left = map(joyX, 4, 9, 0, 255);
          left = left < 0 ? 0 : left;
          left = left > 255 ? 255 : left;
          analogWrite(enableLeft, left);

        } else if (joyX == 4){
          // Stopped
          digitalWrite(rightBackward, LOW);
          digitalWrite(rightForward, LOW);
          digitalWrite(leftBackward, LOW);
          digitalWrite(leftForward, LOW);
          analogWrite(enableRight, 0);
          analogWrite(enableLeft, 0);
        }
      }
      receivedMessage = "";
    }
  }
}

Nothing is changed in the wiring between the uploads.
We can eliminate power sources because are separate from arduino and also it just programming, but I cannot see what.
I have no idea!
thanks!

Sorry, but there is so much wrong with this that I could write a book ...

void loop() {
    dataToSend += map(analogRead(joyX), 0, 1023, 0, 9);
    dataToSend += map(analogRead(joyY), 0, 1023, 0, 9);
    int stringSize = dataToSend.length();
    for (int i = 0; i < stringSize; i++) {
      int charToSend[1];
      charToSend[0] = dataToSend.charAt(i);
      radio.write(charToSend,1);
    }
    terminateChar[0] = 2;
    radio.write(terminateChar, 1);
    dataToSend = "";
}

All that is needed is something like this

void loop() {
    int dataToSend[2];
    dataToSend[0] = analogRead(joyX); // this value is thrown away as it may be wrong
    dataToSend[0] = map(analogRead(joyX), 0, 1023, 0, 9);
    dataToSend[1] = analogRead(joyY); // this value is thrown away as it may be wrong
    dataToSend[0] = map(analogRead(joyY), 0, 1023, 0, 9);
    
    radio.write(&dataToSend, sizeof(dataTosend);
    delay(200); // send 5 times per second
}

See how it is much closer to the style of the working example

On the receiving end you should create a matching array

int dataRecieved[2];
radio.read(&dataReceived, sizeof(dataReceived));

Again, this is very similar to the working version.

...R

Hello,

Hmmm, I will try this maybe this will be fine, but the main problem is that I cannot connect the two Arduino. The connection between them is not fine, and with all the examples, even with yours works fine. Strange!

If you have different ideas. Please do not hesitate!

Thank you very much for all the help.

Quick edit.
Does not work. Any ideas? Tried the change of the code, also every library from the internet for the wireless module. I still cannot connect them, but Hello World, and also Simple RX and Simple TX works fine.
Thanks!

vlad00000:
Hmmm, I will try this maybe this will be fine, but the main problem is that I cannot connect the two Arduino. The connection between them is not fine, and with all the examples, even with yours works fine. Strange!

You need to proof read your Replies after you post them. This is the second time you have said something works and does not work. It is very confusing for me.

Quick edit.
Does not work. Any ideas? Tried the change of the code, also every library from the internet for the wireless module.

What does not work?

You have changed your programs so you need to post the revised versions so we can see exactly what you are trying.

...R

Hello,
Now I am at work but when I will arive home I will post the programs.
Every example from internet is working fine, your tutorial, all are ok. The problem is just software, I think.
This is why I said it works fine, but now nothing works. I am meaning that all examples are working, I have connection, I have stable signal, just when I upload the code from the up post it stops working. Maybe is something wrong in the code.
Thanks!

vlad00000:
Every example from internet is working fine, your tutorial, all are ok. The problem is just software,

Wireless problems can be difficult to debug. My suggestion is to start with one of the working programs and extend it step by step to do what you want being careful to test it after each change to ensure it is still working.

...R