Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed SDFileSystem
Revision 1:56e56d910f78, committed 2022-02-06
- Comitter:
- sacehtia
- Date:
- Sun Feb 06 14:27:16 2022 +0000
- Parent:
- 0:57cec3469a80
- Commit message:
- V1
Changed in this revision
| SDFileSystem.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 57cec3469a80 -r 56e56d910f78 SDFileSystem.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Sun Feb 06 14:27:16 2022 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/SDFileSystem/#8db0d3b02cec
diff -r 57cec3469a80 -r 56e56d910f78 main.cpp
--- a/main.cpp Thu Oct 22 16:18:21 2015 +0000
+++ b/main.cpp Sun Feb 06 14:27:16 2022 +0000
@@ -1,4 +1,6 @@
#include "mbed.h"
+#include "SDFileSystem.h"
+#include <string>
Serial pc(USBTX, USBRX);
Serial esp(p28, p27); // tx, rx
@@ -6,13 +8,15 @@
DigitalOut led1(LED1);
DigitalOut led4(LED4);
Timer t;
+SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
int count,ended,timeout;
char buf[2024];
char snd[1024];
+char fileline[2024];
-char ssid[32] = "SwagInABag"; // enter WiFi router ssid inside the quotes
-char pwd [32] = "yoloswag"; // enter WiFi router password inside the quotes
+char ssid[32] = "CHRISISTHEBEST"; // enter WiFi router ssid inside the quotes
+char pwd [32] = "CHRISRULES"; // enter WiFi router password inside the quotes
void SendCMD(),getreply(),ESPconfig(),ESPsetbaudrate();
void dev_recv()
@@ -180,7 +184,33 @@
strcpy(snd, "print(payload)\r\n");
SendCMD();
wait(1);
-
+ ///////////////////////////////////////////////////////////////////////////
+ FILE *fp2 = fopen("/sd/sdwebserver/TestHTML.html", "r");
+ if(fp2 == NULL) {
+ error("Could not open file for write\n");
+ }
+ string inputString;
+ string file_line = "";
+ string begin = "conn:send(\"";
+ string end = "\")\r\n";
+
+ while (fscanf(fp2,"%[^\n]%*c", inputString)!= EOF) //reads in a string delineated by white space
+ {
+ sprintf(fileline ,"%s%s%s", begin, inputString, end);
+ //For debugging purposes, print out the file contents and the connection tags
+ pc.printf(fileline);
+ pc.printf("\n\r");
+ //file_line = (begin + inputString + end).c_str();
+
+ strcpy(snd, fileline);
+ SendCMD();
+ wait(30);
+ }
+ fclose(fp2);
+
+ wait(1);
+ /////////////////////////////////////////////////////////////////////
+ /*
strcpy(snd, "conn:send(\"<!DOCTYPE html>\")\r\n");
SendCMD();
wait(1);
@@ -189,7 +219,7 @@
SendCMD();
wait(1);
- strcpy(snd, "conn:send(\"<h1> Hi James, NodeMcu.</h1>\")\r\n");
+ strcpy(snd, "conn:send(\"<h1> Christopher Saetia and Thomas Contis, NodeMcu.</h1>\")\r\n");
SendCMD();
wait(1);
@@ -200,7 +230,8 @@
strcpy(snd, "conn:send(\"</html>\")\r\n");
SendCMD();
wait(1);
-
+*/
+ ////////////////////////////////////////////////////////////////////////////
strcpy(snd, "end)\r\n");
SendCMD();
wait(1);