huvex
November 26, 2019, 5:32am
1
Is there any way to export data from a vexcode program into a file (like an array into csv file)? If so, how would you do so and what would that code look like?
1 Like
weilin
November 26, 2019, 7:50am
2
Please, see these related topics for examples of saving files to SD Card from the program running on V5 brain:
Here’s a simple example showing how to use the VCS SD card save and load file API. This saves some information into a file called “test.h” on the SD card and then reads it back again.
#include "robot-config.h"
// storage for some information to save
uint8_t myTestData[ 100 ];
uint8_t myReadBuffer[ 1000 ];
int main() {
// set the test data to something detectable
for(int i=0;i<100;i++) {
myTestData* = i * 2;
}
// write test data to SD Card
int nWritten…
Not sure what you did there, only std::ofstream ofs; needs to be global
I just tried this in VCS and it works.
#include "robot-config.h"
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <fstream>
std::ofstream ofs;
int main() {
if( Brain.SDcard.isInserted() ) {
// create a file with long filename
ofs.open("a_long_filename_debug.txt", std::ofstream::out);
ofs << "lorem ipsum\r\n";
ofs << "this was a test of a file with long file name\r\n";
o…
I’m currently working on using the SD Card in PROS and was wondering if there is a command that returns a boolean for if the SD-Card is connected. Similar to the vex: :sdcard.isInserted
from the VC API. And if a function doesn’t exist a recommended way for creating my own. Thanks for any help in advance!
1069B - Argonauts
The last example is for PROS, not VEXcode, but it has some useful information.
1 Like