okay, so I've done some more experimenting and trying to figure this out, both bits of code work to display it now and everything compiles nicely. Now I've gotten to a point where I'm not sure anyone here can help with because it has to do with Reddit and IFTTT. I'm going to list what I've found, my code, and then my new problem.
Here's a quick rundown of how everything should work:
I save a post on Reddit
IFTTT then sends a POST using the webhook thing, I'm guessing it sends all the data I have laid out in the body of the application/json
My ESP8266 then receives that and takes the Title data
It displays that Title data onto the OLED
I'm using saving a post on Reddit as my trigger as it's easy to do and I can trigger it anytime I need to test it. Plus I want this working with Reddit anyways so learning with this just makes it easy.
So both
display.println((const char *) in["content"]);
and
display.println(in["content"].operator const char *());
work and display what is supposed to be displayed on the OLED screen.
When I use my Thinger.io dashboard to view my ESP8266 I can see the API and I'm not sure if you would call it a function or maybe event? but anyway I can test send data to it, so I'm guessing it sends it as IFTTT should. I can put in any text and it has "String" by the input box so I'm guessing the data sent is supposed to be a string? I'm not exactly sure how that works so i may be completely wrong. When I put any text in there and send it, everything works as it should and it displays the text I inputted on the OLED. Here's a screenshot of what I'm talking about for the input box:
Imgur: The magic of the Internet
I've also edited the IFTTT application/json body to this:
{
"in":
[
{
"title": "<<<{{Title}}>>>",
"url": "<<<{{PostURL}}>>>",
"description": "<<<{{Content}}>>>",
"thumbnail": {
"url": "<<<{{ImageURL}}>>>"
},
"footer": {
"icon_url": "https://www.redditstatic.com/desktop2x/img/favicon/favicon-32x32.png",
"text": "/u/<<<{{Author}}>>> | <<<{{PostedAt}}>>>"
}
}
]
}
I'm not 100% if that is the correct stuff to put in there but everywhere I've seen stuff about using Reddit with IFTTT, they use this as the body for the webhook.
I've changed some stuff around in my code, like the names and the Thing name, here's my current code that compiles and works when I manually send info through Thinger.io:
#define _DEBUG_
#include <SPI.h>
#include <Wire.h>
#include <ThingerESP8266.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 32, &Wire);
#define USERNAME "***"
#define DEVICE_ID "***"
#define DEVICE_CREDENTIAL "***"
#define SSID "***"
#define SSID_PASSWORD "***"
ThingerESP8266 thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
void setup() {
Serial.begin(115200);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.display();
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.println("Started"); //this is just used as feedback for me to know it started
display.display();
thing.add_wifi(SSID, SSID_PASSWORD);
thing["new_save"] << [](pson& in){
display.clearDisplay();
display.setCursor(0, 0);
display.println("Post Title:");
display.println(in["title"].operator const char *());
display.display();
};
}
void loop() {
thing.handle();
}
So, great, it works! I'm very grateful and excited I was able to get help with the compiling issue so thank you very much!
Now onto my new problem. When I save a post and the IFTTT applet gets triggered, everything works except actually displaying the title text. It runs the Thing as the OLED Switches from "Started" to "Post Title:" but there's no other text that gets displayed... IFTTT says the applet ran successfully but I'm guessing I've done something wrong with the IFTTT application/json body and that's why it does not display the title? So my problem I'm pretty sure has now moved onto IFTTT, as the code works and I can manually trigger it with Thinger.io.