PlatformIO Community

Installing Circus of Things library

I’m trying to install this library but end up getting this error message:

lib/CircusESP32Lib-1.0.0/src/CircusESP32Lib.cpp: In member function 'double CircusESP32Lib::read(char*, char*)':
lib/CircusESP32Lib-1.0.0/src/CircusESP32Lib.cpp:127:27: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   if (responsebody!=(char)0) {
                           ^
lib/CircusESP32Lib-1.0.0/src/CircusESP32Lib.cpp: In member function 'char* CircusESP32Lib::parseServerResponse(char*, char*, int)':
lib/CircusESP32Lib-1.0.0/src/CircusESP32Lib.cpp:180:18: error: invalid conversion from 'char' to 'char*' [-fpermissive]
     return (char)0;
                  ^
lib/CircusESP32Lib-1.0.0/src/CircusESP32Lib.cpp: In member function 'double CircusESP32Lib::read(char*, char*)':
lib/CircusESP32Lib-1.0.0/src/CircusESP32Lib.cpp:91:19: warning: control reaches end of non-void function [-Wreturn-type]
  WiFiClientSecure client;
                   ^~~~~~
*** [.pio\build\featheresp32\lib822\CircusESP32Lib-1.0.0\CircusESP32Lib.cpp.o] Error 1
========================================================== [FAILED] Took 10.11 seconds ==========================================================

I have placed the library in the lib folder on the sidebar in platformio.
image

Here is my code:

/*
    PrøveEksamen Oppgave ESP32 og CircusOfThings
                    Markus Iversen
                      31.05.2022

*/

#include <Arduino.h>
#include <CircusESP32Lib.h>

char ssid[] = "CasaIversen";
char password[] = "Sarpsborg08";
char server[] = "www.circusofthings.com"; // Nettsiden hvor CoT-serveren er
char token[] = "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI5ODQ1In0.5PBH0uNS3FT9GQ-d9-1Q_oQdBHafAKVt2UI3TlxVIwE";

char lysKey[] = "6289";

CircusESP32Lib circusESP32(server,ssid,password);

#define photoPin 39

int photoVal;
int lysstryke;

void setup() {
  // plasser oppsett koden her, for å kjøre den èn gang:
  Serial.begin(115200);
  circusESP32.begin();

  pinMode(photoPin, INPUT);
  
}

void loop() {
  // plasser hoved koden her, for å kjøre den gjenløppende:
  photoVal = analogRead(photoPin);
  lysstryke = map(photoVal, 0, 4095, 100, 0);

  circusESP32.write(lysKey, lysstryke, token);

  Serial.println(lysstryke);
  delay(500);


}

Thanks in advance

Yeah no way that compiles without warnings. My suggestion would be to change (char)0 to nullptr in both places (CircusESP32Lib.cpp:127 and CircusESP32Lib.cpp:180).

1 Like

seems to have fixed it, thank you!

Since PR https://github.com/jaumemirallesisern/CircusESP32Lib/pull/1 went through, you can also remove the library from the lib/ folder and just use lib_deps = https://github.com/jaumemirallesisern/CircusESP32Lib.git in the platformio.ini.