ROBOTC.net forums
http://robotc.net/forums/

RobotC and Excel
http://robotc.net/forums/viewtopic.php?f=1&t=5206
Page 1 of 1

Author:  Jim Klaas [ Sun Dec 02, 2012 9:02 pm ]
Post subject:  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

Author:  amcerbu [ Sun Dec 02, 2012 9:16 pm ]
Post subject:  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.

Author:  mightor [ Mon Dec 03, 2012 12:47 am ]
Post subject:  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

Author:  Kazuo [ Sun Feb 24, 2013 9:46 pm ]
Post subject:  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'.

Author:  mightor [ Mon Feb 25, 2013 12:42 am ]
Post subject:  Re: RobotC and Excel

Put "&" in front of the offending variables. Without the whole line, I can't give you an example.

= Xander

Author:  Kazuo [ Mon Feb 25, 2013 2:09 am ]
Post subject:  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);
  }
}

**********

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/