View unanswered posts | View active topics It is currently Tue Feb 09, 2016 6:58 am

 Page 1 of 1 [ 4 posts ]
 Print view Previous topic | Next topic
Problem Cell
Author Message
Rookie

Joined: Tue Mar 11, 2014 3:04 pm
Posts: 2
Problem Cell
Good evening
I do a lot of research and I have a problem, I have a 21 * 30 table consisting of 1 and 0, looking for a way to read cell by cell that starts with the beginning (top left).
Thereafter have this possibility: If 'cell' is equal to 1 => instruction.
Thank you

Last edited by Skio on Mon Mar 31, 2014 4:55 pm, edited 3 times in total.

Mon Mar 31, 2014 2:21 pm
Moderator

Joined: Thu Jan 03, 2013 5:10 pm
Posts: 202
Location: The plateau north of the Ohio River Valley, also known as Cave Country.
Re: Problem Cell
You are in need of an array. Arrays are chunks of data that can be accessed by an index. To declare an array, do this:

 Code: [];// Exampleint myarray[3];

Initialization of arrays with starting values is as follows:

 Code:int myarray[3] = {1, 4, 27};

Also, ROBOTC supports 2D arrays on some platforms, and the NXT is one of them. This is a 2D array:

 Code:int my2darray[4][3];// With starting valuesint my2darray[4][3] = {    { 1, 2, 3},    { 9, 4, 1},    { 6,90,37},    { 2, 0,81}}

To access a value in an array, use the index values for that data. Note that arrays are zero-based, meaning the first value is [0], not [1].

_________________
I'm not a robot! I'm british! ~ quote from an asparagus
I am not a robot! I am a unicorn! ~ quote from a robot

Mon Mar 31, 2014 4:14 pm
Rookie

Joined: Tue Mar 11, 2014 3:04 pm
Posts: 2
Re: Problem Cell
I'm sorry I'm a beginner, I think I explained my problem wrong,
I have an external file '.mat 'is a array containing only 1 and 0, I would scan each cell starting with (1,1) and (2,1) then '(3,1) [...] (21,31). If the cell is equal to 1 my robot made ​​a instuction, if the cell is equal to 0 the robot nothing.

 Attachments: monochrome.png [ 30.36 KiB | Viewed 1324 times ]
Mon Mar 31, 2014 4:51 pm
Moderator

Joined: Thu Jan 03, 2013 5:10 pm
Posts: 202
Location: The plateau north of the Ohio River Valley, also known as Cave Country.
Re: Problem Cell
Oh, ok. Since the file is stored on your computer, you will need to do this:

Using a computer language ( I recommend C#), create a program for your PC that reads the file and then sends it to your nxt via a serial port with a bluetooth dongle. You will have to know how to read the .mat format, which you can figure out by looking it up or by contacting the developer of your matrix editor. Have an nxt program that reads the incoming messages and uses them.

Of course, there are downsides to this: You will likely have to learn a new language, purchase a dongle (although I think somehow you could use the USB cable as well), and spend much time. Thus, you may want to consider manually hard coding in the matrix straight to your robot. That, too, can be time consuming.

A third and final option which would probably be best (I saved the best for last ) would be to find a program on the web already written to do what I described in the first option with a USB cable. The only problem with that is seeing if such a program exists.

-A

_________________
I'm not a robot! I'm british! ~ quote from an asparagus
I am not a robot! I am a unicorn! ~ quote from a robot

Wed Apr 02, 2014 3:03 pm
Display posts from previous:  Sort by
 Page 1 of 1 [ 4 posts ]

#### Who is online

Users browsing this forum: No registered users and 1 guest

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    2014 Robotics Academy Summer of Learning    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge