Introduction: LinkIt One File Grabber and Reader
Did you know you can download a file and then read it using only the LinkIt One? The LinkIt One file grabber might be a life saver some day. It could happen! This could be done with the right Arduino setup of course but it seems just slightly more elegant using the LinkIt One. And it is really fun. To make it easy I have uploaded a test.txt to my server for you to use. This is another one of those 10 minute instant gratification projects that is just plain fun and if you're not very careful you run the risk of learning additional capabilities of the LinkIt One. So are you ready to enjoy some file downloading awesomeness sauce? Yes? Then let's go!
Step 1: Configure Sketch, Upload, Download
Okay download the Files.ino sketch and open it in your Arduino IDE. The one you added the LinkIt One plugin to. Make sure you have the LinkIt One selected in the boards menu. Okay here is what you change.
As usual you have to add your WiFi network name, password, and select the type of network encryption you are running. here check this out:
#define WIFI_AP "Your_network_name" //some people like to use FBI_Surveillance_Van
#define WIFI_PASSWORD "You_network_password"// i hope your password is not PASSWORD
#define WIFI_AUTH LWIFI_WEP // choose from LWIFI_OPEN, LWIFI_WPA, or LWIFI_WEP according to your WiFi AP configuration
Got that done? Goooooood. Next step you add the website URL that has the file and the location of the file. Like this:
// This sample connects to HTTP server and download a file to LinkIt ONE internal storage
#define SITE_URL "www.volthauslab.com"
#define FILE_NAME "/test.txt"
#define DOWNLOAD_FILENAME "test.txt"
Now I have added the correct information of what website the file is residing at as well as the file location and name. Yes I do the work and you can just cruise. Hey I'm good like that.
Okay made the network changes? yes? Then you're ready to upload the sketch to your LinkIt One. make sure you have selected the correct port (debug) and you should be good to go.
After you have uploaded you may need to reset the LIO. Now, switch to your modem port and open the serial monitor. Type start, or go (whatever) into the send field at the top of the serial monitor then click send. That should get it going. Oh by the way the comm speed in the sketch is wrong, Use 9600.
If in the serial monitor you read:
start download file
You did it, you downloaded a file off the Interwebs using only the LinkIt One. That is awesome. You deserve a treat. Now let's mosey on to the next step and read the Test file ok?
Step 2: Read the File
Okay let's wind this up.
Upload the ReadWrite sketch to your LinkIt One (same drill as before but this time you can use the sketch as is, no changes needed. use same Comm speed of 9600. After this is done you open the serial monitor just as before and you can read the file.
Wow, congratulations you have downloaded and read a file using a lil' micro controller board. How cool is that? I hope you enjoy this I'ble about the capabilities of the LinkIt One.
Here is what the txt. file contains:
"Test file for downloading with LinkIt One"
We have a be nice policy.
Please be positive and constructive.