void setup and void loop error whit dth11 and I2c/spi oled project

ok been at this for hrs fixed most error (i think so :roll_eyes: ) started whit 72 of them… anyway this code comes from a website and it was full of errors
http://halfbyteblog.wordpress.com/2014/03/03/it-may-be-small-but-this-oled-is-cute-and-useful-and-that-little-dht11-really-knows-when-something-is-hot-or-not/

so now i am stuck whit these errors and i dont know what else to try could anyone tell me how to fix it please i would greatly appreciate it, first is the orriginal sketch

#include <SoftwareSerial.h>
#include <IIC_without_ACK.h>
#include ‚Äúoledfont.c‚ÄĚ ¬†

#define OLED_SDA 8
#define OLED_SCL 9

IIC_without_ACK oled(OLED_SDA, OLED_SCL);//9 ‚ÄĒ sda,10 ‚ÄĒ scl

/*
* DHT Temperature Sensor 
// Connect DHT pin 1 (on the left) of the sensor to +5V
// Connect DHT pin 2 of the sensor to whatever your DHTPIN is
// Connect DHT pin 3 (on the right) of the sensor to GROUND
*/
 
// include the library code

#include <TinyDHT.h>        // lightweight DHT sensor library
#include <avr/power.h>      // needed to up clock to 16 MHz on 5v Trinket
 
// Uncomment whatever type sensor you are using!
#define DHTTYPE DHT11     // DHT 11 
//#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)
#define TEMPTYPE 1        // Use Fahrenheit (0 for celsius)
#define DHTPIN 1          DHT dht(DHTPIN, DHTTYPE); // Define Temp Sensor
static unsigned char *spt; 
/***************************************************************************/
static void pushb(const char b)
{
 ¬† ¬†spt‚Äď;
    *spt = b;
}

/***************************************************************************/
static unsigned char popb()
{
    unsigned char b;
    b = *spt;
    spt++;
    return b;
}

/***************************************************************************/
void printnum(unsigned char x, unsigned char y, int num)
{
 ¬† ¬† ¬† ¬†char st[]=‚ÄĚ ¬† ‚Äú;
    int digits=0;
        int pos=0;
        
    if(num < 0)
    {
        num = -num;
 ¬† ¬† ¬† ¬†oled.Char_F6x8(x,y,‚ÄĚ-‚ÄĚ);
    }

    do {
        pushb(num%10+’0?);
        num = num/10;
        digits++;
    }
    while (num > 0);
        while(digits > 0)
          {
                  st[pos]=popb();
                  x++;
 ¬† ¬† ¬† ¬† ¬† ¬†digits‚Äď;
                  pos++;
          }
         oled.Char_F6x8(x,y, st);
}
 
void setup() {  
  dht.begin();  // Initialize DHT Teperature Sensor
  oled.Initial();
}
 
void loop() {
  int8_t h = dht.readHumidity();               // Read humidity
  int16_t t = dht.readTemperature(TEMPTYPE);   // read temperature
  
  delay(2000);
  oled.Fill_Screen(0×00);
 
  if ( t == BAD_TEMP || h == BAD_HUM ) { // if error conditions (see TinyDHT.h)
 ¬† ¬†oled.Char_F6x8(0,0,‚ÄĚBad Read on DHT‚ÄĚ); // ¬† print error message
  } else {
 ¬† ¬†oled.Char_F6x8(0,2,‚ÄĚHumidity:‚ÄĚ);
    printnum(60,2,h);
 ¬† ¬†oled.Char_F6x8(78,2,‚ÄĚ%‚ÄĚ); 
 ¬† ¬†oled.Char_F6x8(0,4,‚ÄĚTemp: ‚Äú);
    printnum(36,4,t);
 ¬† ¬†oled.Char_F6x8(50,8,‚ÄĚF‚ÄĚ); ¬† ¬† 
  }
  delay(2000);  // Read temp every second (2000 ms) (DHT sensor max rate)
}

this is my semi fixed sketch

#include <dht.h>
#include <SoftwareSerial.h>
#include <IIC_without_ACK.h>
#include "oledfont.c"  



#define dht
#define OLED_SDA 8
#define OLED_SCL 9
#define BAD_HUM    -1  // Bad humitidy reading
#define BAD_TEMP -999  // Bad temperature reading
IIC_without_ACK oled(OLED_SDA, OLED_SCL);//9 ‚ÄĒ sda,10 ‚ÄĒ scl

/*
* DHT Temperature Sensor 
// Connect DHT pin 1 (on the left) of the sensor to +5V
// Connect DHT pin 2 of the sensor to whatever your DHTPIN is
// Connect DHT pin 3 (on the right) of the sensor to GROUND
*/
 
// include the library code

#include <TinyDHT.h>        // lightweight DHT sensor library

 
// Uncomment whatever type sensor you are using!
#define DHTTYPE DHT11     // DHT 11 
//#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)
#define TEMPTYPE 1        // Use Fahrenheit (0 for celsius)
#define DHTPIN 1          DHT dht(DHTPIN, DHTTYPE); // Define Temp Sensor
static unsigned char *spt; 
/***************************************************************************/
static void pushb(const char b)
{
    spt--;
    *spt = b;
}

/***************************************************************************/
static unsigned char popb()
{
    unsigned char b;
    b = *spt;
    spt++;
    return b;
}

/***************************************************************************/
void printnum(unsigned char x, unsigned char y, int num)
{
        char st[]="   ";
    int digits=0;
        int pos=0;
        
    if(num < 0)
    {
        num = -num;
        oled.Char_F6x8(x,y,"-");
    }

    do {
        pushb(num%10+'0');
        num = num/10;
        digits++;
    }
    while (num > 0);
        while(digits > 0)
          {
                  st[pos]=popb();
                  x++;
            digits--;
                  pos++;
          }
         oled.Char_F6x8(x,y, st);
}
 
void setup() {  
  
dht.begin(); // Initialize DHT Teperature Sensor
oled.Initial();
}  
 
void loop() {
  int8_t h = dht.readHumidity();               // Read humidity
  int16_t t = dht.readTemperature(TEMPTYPE);   // read temperature
  
  delay(2000);
  oled.Fill_Screen(000);
 
  if ( t == BAD_TEMP || h == BAD_HUM ) { // if error conditions (see TinyDHT.h)
    oled.Char_F6x8(0,0,"Bad Read on DHT"); //   print error message
  } else {
    oled.Char_F6x8(0,2,"Humidity:");
    printnum(60,2,h);
    oled.Char_F6x8(78,2,"%"); 
    oled.Char_F6x8(0,4,"Temp: ");
    printnum(36,4,t);
    oled.Char_F6x8(50,8,"F");     
  }
  delay(2000);  // Read temp every second (2000 ms) (DHT sensor max rate)
}

than the errors

sketch_jul19b.ino: In function 'void setup()':
sketch_jul19b:81: error: expected primary-expression before '.' token
sketch_jul19b.ino: In function 'void loop()':
sketch_jul19b:86: error: expected primary-expression before '.' token
sketch_jul19b:87: error: expected primary-expression before '.' token

Please edit your question and use code tags, not quote tags.

As it is hard to read in quotes instead of code, I don't know the cause of your error just yet. It may be related to this line, which itself cannot be good:

    while (num > 0);

Which basically translates to "If num > 0 then halt the program completely"...!

This is a very very wild guess - but only takes a few seconds to try

What happens if you change dht. to DHT. everywhere? And maybe not for the #include line? Or maybe only for the #include line?

Ignore this - the correct answer seems to be in Reply #3

...R

I think I see your problem...

You are missing a carriage return here:

#define DHTPIN 1          DHT dht(DHTPIN, DHTTYPE); // Define Temp Sensor

That should read

#define DHTPIN 1          
DHT dht(DHTPIN, DHTTYPE); // Define Temp Sensor

Also you seem to have a rogue

#define dht

which is really fouling things up. Get rid of it.

majenkotech: You are missing a carriage return here:

Well spotted. I was looking for a line starting DHT and didn't notice that.

It is a common practice among programmers to use a variable name that is the same as the Class name - in this case DHT dht(DHTPIN, DHTTYPE); and in my experience it frequently causes great confusion - this being a good example

If the programmer had even made a slight change and used DHT myDht(DHTPIN, DHTTYPE); the problem would have been much easier to spot.

The other situation in which it is confusing - especially for beginners - is trying to figure out (again using this example) whether the thing must be called dht or whether any-old-name would do.

...R