Error reading myip array from CayenneEthernet.h

  • Arduino MEGA, ethernet module

I am using ethernet module to upload data to a server using Cayenne-Arduino-Library and arduino_uip. I want to read the myip[] from CayenneEthernet.h

Original:

// DHCP with domain
void begin(const char* auth,
	const char* domain = BLYNK_DEFAULT_DOMAIN,
	uint16_t port = BLYNK_DEFAULT_PORT,
	const byte mac[] = _blynkEthernetMac)
{
    BLYNK_LOG("Here we are");// I added this to find this function.
    ...
	IPAddress myip = Ethernet.localIP();
	BLYNK_LOG("My IP: %d.%d.%d.%d", myip[0], myip[1], myip[2], myip[3]);
}

Edited:

// DHCP with domain
int* begin(const char* auth,
	const char* domain = BLYNK_DEFAULT_DOMAIN,
	uint16_t port = BLYNK_DEFAULT_PORT,
	const byte mac[] = _blynkEthernetMac)
{   
    ...
	IPAddress myip = Ethernet.localIP();
	BLYNK_LOG("My IP: %d.%d.%d.%d", myip[0], myip[1], myip[2], myip[3]);
	return myip;
}

Arduino code:

#define CAYENNE_DEBUG         // Uncomment to show debug messages
#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#include <CayenneDefines.h>
#include <UIPEthernet.h>
#include <BlynkSimpleUIPEthernet.h>
#include <CayenneEthernetClient.h>
#define VIRTUAL_PIN V1
#define VIRTUAL_PIN V0
...
void setup(){
...
  int *A=Cayenne.begin(token);
...
}

void loop(){
...
}

I am getting this error:

error: void value not ignored as it ought to be

Question:

How can I return the array correctly?

Personally for me, I don’t understand this line: int* begin(const char* auth, ?

I want to return array and to read it on arduino.

I can’t test right now, but what do you get it you put this in your loop function?

Serial.println(Ethernet.localIP());

2 Likes

It works thnx!! But how did you know that where is ethernet defined?
UPDATE: It is on Ethernet.h , it was a bit hard to think about it.

1 Like