Chat freely about anything...

User avatar
By lucasromeiro
#85180
marth909 wrote:I created a new api token in my dropbox account.
I uploaded the basic_upload example to my esp8266 board.

But for some reason it is getting Error! in the serial monitor. Any ideas why it is failing?
Thanks,

Here is my sketch:

/*
DropboxManager ESP8266

Copyright (c) 2018 Lucas Romeiro

Author: Lucas Romeiro
Contact: lucas_romeiro@hotmail.com

Example created to understand how file upload works.


*/

#include <ESP8266WiFi.h>
#include <DropboxManager.h>

const char* ssid = "<name here>";
const char* password = "<password here>";

DropboxMan myDrop;

void setup() {
Serial.begin(115200);
Serial.println();
Serial.print("connecting to ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());

SPIFFS.begin();
File file = SPIFFS.open("/test.txt", "a");
if (!file) {
Serial.println("Error on create file.");
} else {
Serial.println("file.println >> Test... From ESP8266!");
file.println("Test... From ESP8266!");
}
file.close();
SPIFFS.end();

}

void loop() {
//myDrop.begin("<your token here>");
myDrop.begin("Mth2-D_NtMQAAAAAAACspkIltDT8BBvhd8EYJfMV_uZrXwEyZe-zFRPIBbF6KN_n");
//if (myDrop.fileUpload("/test.txt", "/math/test.txt", 1)) { //Sending a test.txt file to /math/test.txt
if (myDrop.fileUpload("/test.txt", "/temp_humid/test.txt", 1)) { //Sending a test.txt file to /temp_humid/test.txt
Serial.println("File Sent!");
} else {
Serial.println("ERROR!");
}

while (true) {
yield();
ESP.wdtFeed();
}
}


Please enable DEBUG mode and return the result.
Details: Readme