Transferring Data from Arduino to CSnap
It’s great when you’re able to get the data transferred to the SD card associated with the Arduino- but what if you want to play with the data on CSnap?
This program, boringly titled program.exe is the solution for that. Here’s how it works:
1. Locate the .txt data file from the SD card. If it is not titled “DATALOG”, then rename it as such.
2. Locate your program.exe (download it here). Drag and drop program.exe into the same folder as DATALOG.txt
3. Double-click on program.exe
4. Magic! A file, output.xml, has been generated (with the help of C++). This output XML file is actually the code for a custom CSnap block.
5. The file output.xml can be retitled to whatever you wish. Let’s call it ‘data_block’. Import this to CSnap as a new block, and it will have generated a list for you!
This may be a little hard to understand, so here’s a video with instructions.
Want to download program.exe and see it work for yourself? You can download it here.
More In-Depth Info about program.exe
So you might be curious about how program.exe actually works and was created. So here’s a brief description.
I wrote a program in the coding language C++. The program reads data from the text file, line by line, and inserts it into a newly generated XML file. I test this in the compiler to make sure it works. I then ask the compiler to generate my program.exe looking for only one file name- DATALOG.txt. This is the only txt file it will open and search. The output file will always be called output.xml. I did this for simplicity.
How did I go about coding this?
I have taken many computer science courses, so I have a background knowledge of C++. Anything else I was curious about- converting data to XML via C++, for example, I researched on my own (aka Google!). I then tested, over and over again.
I was informed about version control, and started to use it later on in the project. This allowed me to keep track of the changes I made. I can see where I added code, where I deleted code, and add notes. This is great if I ever need to look back and say “wait a minute, what did I do?” in case something isn’t working properly and I can’t remember why. My GitHub account, which is my version control system, is here if you would like to view it.
Essentially, GitHub looks at the files on my computer, and uploads them and records changes when I ask it to. It helps me keep track of new versions of files. There is always the ‘master’ branch of the repository (project), where this is the current ‘working’ or ‘best’ code, so to speak. People adding to repositories, such as myself, can work on other ‘branches’ of a repository, and ‘commit’ changes to the code. This is code we send to the repository. Whoever is in charge of the master branch can decide whether or not to let the code changes I made be added to the master branch.