View unanswered posts | View active topics It is currently Thu Oct 23, 2014 6:10 pm






Reply to topic  [ 6 posts ] 
RobotC and Excel 
Author Message
Rookie

Joined: Sun Jul 22, 2012 7:12 pm
Posts: 8
Post RobotC and Excel
How can I record data from the robot and save it to a file so I can import the data into Excel? My first choice would be a live wireless feed from the robot directly to Excel. My second choice would be to have the robot save a file I can extract later and then load into Excel. Any help would be greatly appreciated.

Jim


Sun Dec 02, 2012 9:02 pm
Profile
Novice

Joined: Sun Oct 21, 2012 10:01 pm
Posts: 76
Post Re: RobotC and Excel
You could use the NXT's datalogging functions (I'm not so familiar with how they work) and then recover the data over a USB cable after the program has finished. You could also set up a Bluetooth link from the NXT to the computer, but that might require that you write some computer-side code for receiving raw bytes. Or, if you leave the NXT connected to the computer during the program, you can write to the "debug stream," a window inside of RobotC.


Sun Dec 02, 2012 9:16 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3227
Location: Rotterdam, The Netherlands
Post Re: RobotC and Excel
This might be useful for you: https://nxttime.wordpress.com/2010/01/20/nxt2excel/

Written by Aswin, one the people on this forum.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Dec 03, 2012 12:47 am
Profile WWW
Rookie

Joined: Sun Feb 24, 2013 9:36 pm
Posts: 2
Post Re: RobotC and Excel
It is the first post.
I tried to compile the NXT2excel, the following error appears.
I do not know how can I fix.

Thank you for the advice.

(Errors)
File "NXT2excelExample1.c" compiled on Feb 25 2013 10:26:43
**Error**:'*' Indirection levels mismatch. Call to 'memcpy'. Parameter: 'void * pToBuffer' is 'NXT2excelbuffer[(index - 1) * 2]' of type 'ubyte'.
**Error**:'*' Indirection levels mismatch. Call to 'memcpy'. Parameter: 'void * pToBuffer' is 'NXT2excelbuffer[0]' of type 'ubyte'.


Sun Feb 24, 2013 9:46 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3227
Location: Rotterdam, The Netherlands
Post Re: RobotC and Excel
Put "&" in front of the offending variables. Without the whole line, I can't give you an example.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Feb 25, 2013 12:42 am
Profile WWW
Rookie

Joined: Sun Feb 24, 2013 9:36 pm
Posts: 2
Post Re: RobotC and Excel
mightor wrote:
Put "&" in front of the offending variables. Without the whole line, I can't give you an example.

= Xander


Thank you for your reply.
Example files(NXT2excel.c, NXT2excelExample1.c) in NXT2excel is as follows.
When I compile the NXT2excelExample1.c, I get the error.

Thank you.

(NXT2exce.c)
**********
Code:
#ifdef NXT2excelMaxData
#else
  #define NXT2excelMaxData 27
#endif



  ubyte NXT2excelbuffer[ NXT2excelMaxData *2];

  bool NXT2excelAddValue(int val, byte index)
  {
    if (index<=1 || index >NXT2excelMaxData*2) return false;
    memcpy(NXT2excelbuffer[(index-1)*2],val,sizeof(val));
    return true;
  }


  void NXT2excelSendMessage()
  {
  memcpy(NXT2excelbuffer[0],nPgmTime,sizeof(nPgmTime));
   while (bBTBusy) wait1Msec(10);
    cCmdMessageWriteToBluetooth(NXT2excelbuffer, sizeof(NXT2excelbuffer)+1, mailbox1);
  while (nBluetoothCmdStatus==ioRsltCommPending) wait1Msec(2);
  }
**********

(NXT2excelExample1.c)
**********
#define NXT2excelMaxData 14

#include "NXT2excel.c";


task main()
{
  while(true)
  {
    NXT2excelAddValue(nAvgBatteryLevel,2);
    NXT2excelAddValue(nImmediateBatteryLevel,3);
    NXT2excelAddValue(SensorValue[S1],4);
    NXT2excelAddValue(SensorValue[S2],5);
    NXT2excelAddValue(SensorValue[S3],6);
    NXT2excelAddValue(SensorValue[S4],7);
    NXT2excelAddValue(motor[motorA],8);
    NXT2excelAddValue(motor[motorB],9);
    NXT2excelAddValue(motor[motorC],10);
    NXT2excelAddValue(nMotorEncoder[motorA],11);
    NXT2excelAddValue(nMotorEncoder[motorB],12);
    NXT2excelAddValue(nMotorEncoder[motorC],13);
    NXT2excelAddValue(nNxtButtonPressed,14);
    NXT2excelSendMessage();
    wait1Msec(50);
  }
}

**********


Mon Feb 25, 2013 2:09 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.