Getting several errors while compiling. About to pull my hair out

Let me start by saying.. I'm new to Arduino, and am learning tons of things every day. I've been working on this for several hours and am totally lost with what I need to change. If anyone can give me ANY insight it would help me a ton.

Hardware -

ESP8266 nodeMCU, DHT22.

#include <dht.h>

#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>
#include <DHT.h>

#define DHTPIN D5 // what pin the DHT is connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)

const int TEMPERATURE_INTERVAL = 30;
unsigned long last_temperature_sent = 0;

const int HUMIDITY_INTERVAL = 30;
unsigned long last_humidity_sent = 0;
String display_temp;
String display_humid;

DHT dht(DHTPIN, DHTTYPE);

// Your network name and password.
char ssid[] = “XXXX”;
char wifiPassword[] = “XXXX”;

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = “XXXXX”;
char password[] = “XXXXX”;
char clientID[] = “XXXXX”;

 

void getSendTemperature() {
if (millis() – last_temperature_sent >= TEMPERATURE_INTERVAL * 1000UL || last_temperature_sent == 0) {
float temperature = dht.readTemperature(true);

if (isnan(temperature)) {
Serial.println(“Failed to read from DHT sensor!”);
return;
}
display_temp = temperature;
Serial.print(“Temperature: “);
Serial.print(temperature);

Serial.println(” °F”);
Cayenne.virtualWrite(8, temperature);
last_temperature_sent = millis();
}
}

void getSendHumid() {
if (millis() – last_humidity_sent >= HUMIDITY_INTERVAL * 1000UL || last_humidity_sent == 0) {
float humidity = dht.readHumidity();

if (isnan(humidity)) {
Serial.println(“Failed to read from DHT sensor!”);
return;
}
display_humid = humidity;
Serial.print(“Humidity: “);
Serial.print(humidity);
Serial.println(” %”);
Cayenne.virtualWrite(9, humidity);
last_humidity_sent = millis();
}
}

 

 

void setup() {
// put your setup code here, to run once:
Serial.begin(230400);
dht.begin();
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
}

void loop() {
// put your main code here, to run repeatedly:
getSendTemperature();
getSendHumid();
Cayenne.loop();
}

//Default function for processing actuator commands from the Cayenne Dashboard.
//You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG(“CAYENNE_IN_DEFAULT(%u) – %s, %s”, request.channel, getValue.getId(), getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError(“Error message”);
}

#define DHTPIN D5 // what pin the DHT is connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)

const int TEMPERATURE_INTERVAL = 30;
unsigned long last_temperature_sent = 0;

const int HUMIDITY_INTERVAL = 30;
unsigned long last_humidity_sent = 0;
String display_temp;
String display_humid;

DHT dht(DHTPIN, DHTTYPE);

// Your network name and password.
char ssid[] = “Your WiFi SSID”;
char wifiPassword[] = “Your WiFi PWD”;

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = “Your Cayenne MQTT Username”;
char password[] = “Your Cayenne MQTT Password”;
char clientID[] = “Your Cayenne MQTT Client ID”;

void getSendTemperature() {
if (millis() – last_temperature_sent >= TEMPERATURE_INTERVAL * 1000UL || last_temperature_sent == 0) {
float temperature = dht.readTemperature(true);

if (isnan(temperature)) {
Serial.println(“Failed to read from DHT sensor!”);
return;
}
display_temp = temperature;
Serial.print(“Temperature: “);
Serial.print(temperature);

Serial.println(” °F”);
Cayenne.virtualWrite(8, temperature);
last_temperature_sent = millis();
}
}

void getSendHumid() {
if (millis() – last_humidity_sent >= HUMIDITY_INTERVAL * 1000UL || last_humidity_sent == 0) {
float humidity = dht.readHumidity();

if (isnan(humidity)) {
Serial.println(“Failed to read from DHT sensor!”);
return;
}
display_humid = humidity;
Serial.print(“Humidity: “);
Serial.print(humidity);
Serial.println(” %”);
Cayenne.virtualWrite(9, humidity);
last_humidity_sent = millis();
}
}

void setup() {
// put your setup code here, to run once:
Serial.begin(230400);
dht.begin();
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
}

void loop() {
// put your main code here, to run repeatedly:
getSendTemperature();
getSendHumid();
Cayenne.loop();
}

//Default function for processing actuator commands from the Cayenne Dashboard.
//You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
CAYENNE_LOG(“CAYENNE_IN_DEFAULT(%u) – %s, %s”, request.channel, getValue.getId(), getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError(“Error message”);
}

The error message that I'm receiving during compiling is this -

Arduino: 1.8.9 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

DHT22:89:108: error: macro "CAYENNE_IN_DEFAULT" passed 1 arguments, but takes just 0

CAYENNE_LOG(“CAYENNE_IN_DEFAULT(%u) – %s, %s”, request.channel, getValue.getId(), getValue.asString());

^

DHT22:168:108: error: macro "CAYENNE_IN_DEFAULT" passed 1 arguments, but takes just 0

CAYENNE_LOG(“CAYENNE_IN_DEFAULT(%u) – %s, %s”, request.channel, getValue.getId(), getValue.asString());

^

exit status 1
macro "CAYENNE_IN_DEFAULT" passed 1 arguments, but takes just 0

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I'm truly lost on this and have tried changing several things to see if it would work but no. Any help would be very much appreciated.

Thank you,

J

it appears to be unhappy about %u:

DHT22:168:108: error: macro "CAYENNE_IN_DEFAULT" passed 1 arguments, but takes just 0

 CAYENNE_LOG("CAYENNE_IN_DEFAULT(%u) - %s, %s", request.channel, getValue.getId(), getValue.asString());

program DHT22, line 168, character 108 says "what am I supposed to do with this %u?'

Are you missing a quote somewhere? I don't think the C++ compiler will generally expand a macro that is inside a string constant. Maybe if you showed the rest of your code someone might be able to explain it.

johnwasser:
Are you missing a quote somewhere? I don't think the C++ compiler will generally expand a macro that is inside a string constant. Maybe if you showed the rest of your code someone might be able to explain it.

That is the code in its entirety.

I wonder if the problem is in the heavily nested macros:

Perhaps changing these two lines:

#define CAYENNE_IN_DEFAULT()   CAYENNE_IN(Default)
#define CAYENNE_OUT_DEFAULT()  void CayenneOutDefault()

to these:

#define CAYENNE_IN_DEFAULT   CAYENNE_IN(Default)
#define CAYENNE_OUT_DEFAULT  void CayenneOutDefault()

That could cause errors where the macros are called with empty parens so ever place those macros are used may have to change.

I suspect the problem is compiler dependent.

johnwasser:
I wonder if the problem is in the heavily nested macros:
Cayenne-MQTT-Arduino/src/CayenneHandlers.h at master · myDevicesIoT/Cayenne-MQTT-Arduino · GitHub

Perhaps changing these two lines:

#define CAYENNE_IN_DEFAULT()   CAYENNE_IN(Default)

#define CAYENNE_OUT_DEFAULT()  void CayenneOutDefault()



to these:


#define CAYENNE_IN_DEFAULT  CAYENNE_IN(Default)
#define CAYENNE_OUT_DEFAULT  void CayenneOutDefault()




That could cause errors where the macros are called with empty parens so ever place those macros are used may have to change.

I suspect the problem is compiler dependent.

I was able to cobble it together and get it working. It's now online and measuring temp.

It's not perfect.. but it's a start to build off of. My only complaint thus far is that my readings stay consistent in Fahrenheit but in graph form it shows values in the 200,000-800,000 range. Which makes it difficult for me to set a trigger. I haven't dived into that yet.. I was just happy to get this working and online.