embed txt file in index.htm ?
lfreeze
Posts: 174
Thanks Mike G for some really brilliant work.
I am new to the Spinneret forum. I have had success implementing the tutorial, and can access my
Spinneret. I did stumble with the setup of my Belkin router but was able to overcome those issues.
I want to attempt the following project:
1. Write variables of sensor values once each minute to the SD card on the Spinneret board,
As a txt file.
2. Embed the txt file in Index.htm.
3. Every 24 hours erase the txt file and start a new one.
This will allow a view of a log the txt file over a 24 hour period each time the spinneret is
Accessed.
.I believe I have the skills to accomplish items one and three. I need help/direction with item two.
Is it possible to embed at txt file in Index.htm or is there an easier way to accomplish this.
Thank you!
Larry
I am new to the Spinneret forum. I have had success implementing the tutorial, and can access my
Spinneret. I did stumble with the setup of my Belkin router but was able to overcome those issues.
I want to attempt the following project:
1. Write variables of sensor values once each minute to the SD card on the Spinneret board,
As a txt file.
2. Embed the txt file in Index.htm.
3. Every 24 hours erase the txt file and start a new one.
This will allow a view of a log the txt file over a 24 hour period each time the spinneret is
Accessed.
.I believe I have the skills to accomplish items one and three. I need help/direction with item two.
Is it possible to embed at txt file in Index.htm or is there an easier way to accomplish this.
Thank you!
Larry
Comments
If you want to do something fancy then you'll need to HTMLize the txt file on the fly.
I spent about two days trying all kinds of exotic solutions before posting.
Larry
In regards to your message:
For a simple SD card file creation, you might try something like the following:
(Note: the FileExists method is a method down towards the end of the HTTPServ spin file.)
Now, this same concept can be used with variables:
Now you've got the concept for storing sensor data to an sd card... put the data into a variable, write it to the file and voila! Better than sliced bread on a stick.
You can certainly get much more fancy than this, but it's a good foundation to start with. If you have lots of sensors, and they are all giving some kind of decimal value, you can reduce your coding by using a repeat loop:
Amazing device. I constantly find myself jumping three steps ahead with coding, only to crash and burn
Due to my lack of knowledge. I will modify my code with your examples and see where it leads me,
Thanks again.
Larry
Also- one thing to note in the examples above.... if the file already exists, it does nothing. It's sort of a one-shot as it's written. To RE-write the file, simply add the line "SDCard.deleteEntry(@logfile)" as follows:
Again, this is very crude... but good to tinker with until you get the hang of it.