How to send / access an variable (long [][]) to / from PC?

Post your NXJ projects, project ideas, etc here!

Moderators: 99jonathan, roger, imaqine

How to send / access an variable (long [][]) to / from PC?

Postby Sonny1982 » Fri Jul 02, 2010 12:15 pm

He guys, I have a NXT remote car which is controlled by another NXT. The car saves data in an 2 dimensional arry which is [100][3]. Now, if the array is fully loaded, I want to close the connection from the car to the remote and open a connection to the PC. No problem so far. But how can I access or send the array from the car to the PC now?

Hope someone could help me?

Regards
Sonny1982
New User
 
Posts: 3
Joined: Wed Jun 30, 2010 8:51 am

Re: How to send / access an variable (long [][]) to / from P

Postby Shawn » Sat Jul 03, 2010 12:47 am

Sonny1982 wrote: an 2 dimensional arry which is [100][3]. .... how can I access or send the array from the car to the PC now?

Regards

Can't you just use a dataOutputStream and loop through it

for(...x...){
for (...y...){
writeLong(carData[x][y]);
}
}

Then on the pc, would do the opposite and read it in.

This assumes your array is really full. If not then you'd have to work out a scheme to tell the pc how much data to read it.

EX

write x.length
for (...x...){
write y . length
for (..y..) {
write carData[x][y]

then for your data on the pc side, read data in according to the x.length and y.length values that you sent from the nxt


Shawn
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo


Return to NXJ Projects

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest

cron
more stuff