benredstar

Help needed: Following a sequence from an external file

Recommended Posts

Hello all

I'm new to Mindstorms and I am trying to figure out whether the system will let me do something before I leap in. Here's a sketch of what I want to do, in the hope someone can help me.

Is it possible to use Mindstorms to instruct a motor to follow a sequence of events it reads from an external file? E.g. -

  • perform 10 rotations over 10 seconds
  • perform 12 rotations over 10 seconds
  • perform 18 rotations over 10 seconds
  • perform 20 rotations over 10 seconds
  • and so on and so on, potentially for hundreds of lines

The goal here is to build a machine that can follow very precise programmed sequences. The data that drives that would have to be held in external files (probably just text files, or some sort of database) rather than constructing it in the Mindstorms app from potentially hundreds of blocks.

Thanks in advance!

/ben

Share this post


Link to post
Share on other sites

Which programming language do you use? X3 has the ability to read files. They are in a table format (and I think that they are read as arrays).

Share this post


Link to post
Share on other sites
24 minutes ago, Tcm0 said:

Which programming language do you use? X3 has the ability to read files. They are in a table format (and I think that they are read as arrays).

I'm not using any language. I'm just trying to figure out how do-able this is. I'll look at X3...

/ben

Share this post


Link to post
Share on other sites

image.png.65b166734e61cfaa4ef88a430fba7059.png

It should work more or less like that. There is no "move X rotations for X seconds" so you would have to calculate the speed from that.

I'm not sure about the order the values get read/ written so you might have to write them from last to first.

Share this post


Link to post
Share on other sites
8 hours ago, Tcm0 said:

image.png.65b166734e61cfaa4ef88a430fba7059.png

It should work more or less like that. There is no "move X rotations for X seconds" so you would have to calculate the speed from that.

I'm not sure about the order the values get read/ written so you might have to write them from last to first.

Thanks. To clarify - are all those text nodes looking at the SAME external file? How do the motor nodes understand which bit of the text file is relevant to them?

/ben

Share this post


Link to post
Share on other sites
1 hour ago, benredstar said:

Thanks. To clarify - are all those text nodes looking at the SAME external file? How do the motor nodes understand which bit of the text file is relevant to them?

/ben

The file name is "abc" in this case, it's defined in the upper right corner.

The first row is to write the stuff to the file. It's a list that contains "10", "10", "12", "20".

The second row is the actual reading process. It reads the first value of the list (I'm not sure if it starts from the beginning with the 10 or from the end with the 20), the second read command reads the second value etc.

Share this post


Link to post
Share on other sites

A text file in EV3-G looks like;

10
10
12
20

When you use the file read block, it takes a value from the top row and moves on to the next.

When you want to return to the top, you have to close it.

Also, I believe you can just import the text file to the project.

Share this post


Link to post
Share on other sites
16 hours ago, vl_cn said:

A text file in EV3-G looks like;


10
10
12
20

When you use the file read block, it takes a value from the top row and moves on to the next.

When you want to return to the top, you have to close it.

Also, I believe you can just import the text file to the project.

Thanks! Let me test this on the EV3 and I'll see what happens!

Do you mind if I come back to ask more questions?

/ben

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.