(NXT-G) File Access block stops working at 15

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
graushwein
Posts: 3
Joined: 20 Jun 2013, 20:23

(NXT-G) File Access block stops working at 15

Post by graushwein »

First of all, thanks to all of the great folks who have provides so much info on so many topics. This is my first real issue that the community hasn't already solved!

I'm trying to find/make a working 1D array MyBlock and have been unsuccessful so far. I've tried at least four ways, using the File Access Blocks, to make a new file for each value (Random #) but it always stops working at about 15 entries. What I mean by that is it will continue to create the files, but at about 15 it starts putting zeroes for the remaining. I've once seen it start putting numbers again but soon stopped. Then it stops creating files around 105 total.

It shouldn't be running out of space because the memory is only half used. I haven't verified that the random number block isn't doing it, but I seriously doubt it.

Brian Davis' "Simple1DArray" block does the same thing. I'm not set on this method for array's though. I have the Education version 2.1 and I'm wonderin if the data log can be successfully used?

Is this normal?
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: (NXT-G) File Access block stops working at 15

Post by mattallen37 »

I'm not very familiar with NXT-G, but using the file system as RAM seems like a very bad idea. The files are stored in flash, and there is a (rather low) limit of how many times you can re-write the flash. Also, file access usually requires a good bit of overhead, for things like file handles, etc.

Just a suggestion, but you should consider using a more advanced programming language. NXC is open source, and there is a lot of support (especially on these forums). I know NXC supports arrays of up to 3 dimensions (using the NXC Enhanced FW), but I think it might support 4 or more.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
graushwein
Posts: 3
Joined: 20 Jun 2013, 20:23

Re: (NXT-G) File Access block stops working at 15

Post by graushwein »

Thank you. And under any other circumstance I'd be all over that! (I really enjoy coding [java mostly]) However I am using the NXT to teach my 5 y/o son logic and critical thinking skills, which is a blast for us both. I want to keep something he can use and understand without all the adult stuff.

Anyways, I found that I was using Brian Davis' Simple1DArray incorrectly. His block is pretty good but lacks a few features. This weekend I intend to make some My Blocks and share them with the community. I don't see a reason why I couldn't turn his product into something easily managed behind the scenes to even able to do inserts, deletes (in the list sense) and return the length (total entries).
graushwein
Posts: 3
Joined: 20 Jun 2013, 20:23

Re: (NXT-G) File Access block stops working at 15

Post by graushwein »

Here's a working example using Brian Davis' Simple1DArray block. (Right arrow adds a number and left arrow deletes most recent number.) https://docs.google.com/file/d/0B2ZKXsP ... sp=sharing I hope that the pack and go works and it ultimately helps someone! My test found that it will work up to about 1,200 array entries. (Took a minute though.)

I'm almost done with the universal add/replace. Just need to test it some more.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest