I can't work with wifi module(nrf24l01) and lcd (nokia 5110) at the same time

Hi,

I work the wifi module and lcd display. But not at the same time. Please help.

#include 
#include
#include

RF24 radio(9,10);

LCD5110 myGLCD(4, 3, 2, 0, 1);

extern uint8_t SmallFont[];
extern uint8_t MediumNumbers[];
extern uint8_t BigNumbers[];

//boolean start = true; 
float Voltage = 0;
float Current = 0;
char result[8];
char MyTag[]="EOS-SEM";
char sendingMessage[16];

void setup(void) {

myGLCD.InitLCD();

radio.begin();
radio.setPALevel(RF24_PA_MAX);
radio.setChannel(0x70);
radio.openWritingPipe(0xF5F5F5F5E1LL);
radio.enableDynamicPayloads();
radio.powerUp();
Serial.begin(9600);
delay(1000);
Serial.println("start ");
radio.stopListening();//yeni ekledim.. 



}

void loop(void){




Serial.print("Olcum Yapiliyor = ");
Voltage = 0;
Current = 0;
for(int i = 0; i<1000; i++) {
 Voltage = (Voltage + (.0049 * analogRead(A0))); // (5 V / 1024 = 0.0049) which converter Measured analog input voltage to 5 V Range
delay(1);
}

Voltage = Voltage /1000;
Current = (Voltage - 2.5)/ 0.066; // Sensed voltage is converter to current
//Voltage = Voltage - 2.5;
dtostrf(Current, 6, 2, result);
CreateSendingMessage(MyTag,result);
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):

Serial.print("Current = ");
Serial.println(Current,2); 
//Serial.print("Voltage = ");
//Serial.println(Voltage,2);
Serial.print("Sending message=>");
Serial.println(sendingMessage);
//if(start == true){ 
//const char text[] = "sabri" ;
//radio.write(&text, sizeof(text));
radio.write(&sendingMessage, sizeof(sendingMessage));
delay(200);//veriyi gonderdik eskiden 1 sn idi.

myGLCD.clrScr();
myGLCD.print("Hasan Ali ", LEFT, 0);
delay (5000);


}
void CreateSendingMessage(char* tag, char* data)
{
for(int k=0;k<7;k++)
 sendingMessage[k] = *(tag+k);
sendingMessage[7]=':';
for(int k=8;k<16;k++)
 sendingMessage[k] = *(data+k-8);
}

Have a nice day.

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

Why have you deleted the library names ?
You have not formatted the code very nicely (use Tools > Autoformat in the IDE) and have left html characters eg
in the code.

You appear to be using pins 0 and 1 for the display and this may cause a conflict with the serial console.

You should post a wiring diagram and the code of the receiver and state whether the radio works if you comment out the code which handles the display.

An nRF24 is not WiFi.

...R
Simple nRF24L01+ Tutorial

Hi,

I work the wifi module and lcd display. But not at the same time. Please help.

#include 
#include
#include

RF24 radio(9,10);

LCD5110 myGLCD(4, 3, 2, 0, 1);

extern uint8_t SmallFont[];
extern uint8_t MediumNumbers[];
extern uint8_t BigNumbers[];

//boolean start = true; 
float Voltage = 0;
float Current = 0;
char result[8];
char MyTag[]="EOS-SEM";
char sendingMessage[16];

void setup(void) {

myGLCD.InitLCD();

radio.begin();
radio.setPALevel(RF24_PA_MAX);
radio.setChannel(0x70);
radio.openWritingPipe(0xF5F5F5F5E1LL);
radio.enableDynamicPayloads();
radio.powerUp();
Serial.begin(9600);
delay(1000);
Serial.println("start ");
radio.stopListening();//yeni ekledim.. 



}

void loop(void){




Serial.print("Olcum Yapiliyor = ");
Voltage = 0;
Current = 0;
for(int i = 0; i<1000; i++) {
 Voltage = (Voltage + (.0049 * analogRead(A0))); // (5 V / 1024 = 0.0049) which converter Measured analog input voltage to 5 V Range
delay(1);
}

Voltage = Voltage /1000;
Current = (Voltage - 2.5)/ 0.066; // Sensed voltage is converter to current
//Voltage = Voltage - 2.5;
dtostrf(Current, 6, 2, result);
CreateSendingMessage(MyTag,result);
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):

Serial.print("Current = ");
Serial.println(Current,2); 
//Serial.print("Voltage = ");
//Serial.println(Voltage,2);
Serial.print("Sending message=>");
Serial.println(sendingMessage);
//if(start == true){ 
//const char text[] = "sabri" ;
//radio.write(&text, sizeof(text));
radio.write(&sendingMessage, sizeof(sendingMessage));
delay(200);//veriyi gonderdik eskiden 1 sn idi.

myGLCD.clrScr();
myGLCD.print("Hasan Ali ", LEFT, 0);
delay (5000);


}
void CreateSendingMessage(char* tag, char* data)
{
for(int k=0;k<7;k++)
 sendingMessage[k] = *(tag+k);
sendingMessage[7]=':';
for(int k=8;k<16;k++)
 sendingMessage[k] = *(data+k-8);
}

Have a nice day.

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

I'm not sure why you have 3 #includes with no filenames. But it looks like you may be using pins 0 and 1 for the LCD. Then you are also using Serial...which uses pins 0 and 1.

Steve

Question duplicated in Audio forum for some reason [MERGED] I can't work with wifi module(nrf24l01) and lcd (nokia 5110) at the same time - Programming Questions - Arduino Forum

Steve

@meeeeesut, do not cross-post. Threads merged.