Ethernet Shield problem

I am in the process of making a project where I am taking Pressure, Temperature and Humidity readings from BMP180 and DHT22 sensors respectively. I am showing these readings on three separate shift register based 4 digit seven segment displays. All is fine till now and the displays show the values correctly, but when I try to send these values to a remote http server to save in a database, I run into problems. The display digits are distorted and show random segments lighted up. The sketch is attached. Please help!

Thanks in advance

BHELDisp_Final.ino (17.1 KB)

bips98:
I am in the process of making a project where I am taking Pressure, Temperature and Humidity readings from BMP180 and DHT22 sensors respectively. I am showing these readings on three separate shift register based 4 digit seven segment displays. All is fine till now and the displays show the values correctly, but when I try to send these values to a remote http server to save in a database, I run into problems. The display digits are distorted and show random segments lighted up. The sketch is attached. Please help!

Which board?

If it is a board with just 2 kB RAM like UNO, you are wasting too much RAM!

You'd better use the F-macro with the print function and all string constants.

Such like:

Serial.println("Connecting Arduino to networks...");

should become:

Serial.println(F("Connecting Arduino to networks..."));

If changing the string constants with "Serial.print" is not enough, do the same with "client.print" like:

client.print( "GET /getTemp.asp?");

change to:

client.print(F("GET /getTemp.asp?"));

Then your string constants will not need RAM memory, but only flash memory.
Flash memory in your Arduino is much bigger than RAM memory.

Hi, welcome the forum.

Which Ethernet Shield ?

The normal Ethernet Shield with W5100 (or W5200) chip uses the SPI bus and pin 4 and 10.
The SPI bus is 10,11,12,13.

For your shift register you use 10,11,12,13. Those pins are for Ethernet.
You can use the analog pins as well for the shift registers. For an Arduino Uno, every analog pin can also be a digital pin.

You have many code lines with if-statements. I think the code will improve if you put that into an array with the numbers.

const int p0Values[] = {
  255,        // '0'
  96,          // '1'
  218,        // '2'
  242,        // '3'
};

Thanks jurs for the answer

When I use Serial.println(F("Some Text"));

I get

macro "F" passed 2 arguments, but takes just 1

in setup()

and

'F' was not declared in this scope

in loop()

I am using Uno r3 board

Please help

Can you give the exact code and the full compiler message ?

The code is attached as well as screen shot of the error received, you will notice that there was no error in the setup(), but the error appeared in loop()

BHELDisp_Final.ino (17.4 KB)

I see, we should have told you how to use it.

Use it only for println() and print() and only with text strings.

  Serial.println("Hello World");
  Serial.println(F("Got Arduino ?"));

The "Hello World" is in flash memory and is also in ram.
The "Got Arduino ?" is only located in flash memory, thus no ram is used for that.

You have to print variables in the normal way.

bips98:
The code is attached as well as screen shot of the error received, you will notice that there was no error in the setup(), but the error appeared in loop()

The F-macro is ONLY for "static text" included in double quotes (literal text constants) to be used in the print() and println() functions.

See the examples in my previous posting.

Can I connect DHt22 to an analog port A0 to A5. If yes what is the syntax?

Thanks

Yes, the analog pins are also digital pins for an Arduino Uno

Old code:

#define DHTTYPE DHT22
#define DHTPIN 2  
DHT dht(DHTPIN, DHTTYPE);

New code:

#define DHTTYPE DHT22
#define DHTPIN A0  
DHT dht(DHTPIN, DHTTYPE);

Why use the defines for those ? I would use this:

DHT dht(A0, DHT22);