View unanswered posts | View active topics It is currently Tue Oct 21, 2014 5:11 pm






Reply to topic  [ 2 posts ] 
1.38: new error messages since 1.30: tSensors, TSensorTypes 
Author Message
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post 1.38: new error messages since 1.30: tSensors, TSensorTypes
hi,
it's annoying.
REALLY annoying.
Again new error messages and I don't know why.
No helping information in the RobotC "Help". :evil: :evil: :evil:
Code:

/*
                                 HiTechnic Compass Driver
                                 HTCompassDrv.h
                                 Version  1.0.2.


This program reads the HiTechnic compass and displays the heading on the screen.
Two NXT buttons can also be used
      Left Arrow Button - send command to put the compass in Calibration Mode
      Right Arrow Button - send command to put the compass in Read Mode

The memory model for the HiTechnic compass is

Address       Type            Contents
- - - - - - - - - - - - - - - - - - - - - - - - -
00 – 07H    chars       Sensor version number
08 – 0FH    chars       Manufacturer
10 – 17H    chars       Sensor type
18 – 3DH    bytes       Not used
3E, 3FH    chars       Reserved
40H          byte          Not used
41H          byte          Mode control
42H          byte          Heading } two degree heading
43H          byte          Heading } one degree adder
44, 45H    word          Heading (low byte, high byte)

*/



tSensors CompassPort;

void HTCompassSensor(tSensors port)
{
   SensorType[port] = sensorI2CCustomStd; // this is line 35 !!!!!!!!!!!!!!
  wait10Msec(5);
  nI2CBytesReady[port]=0;
  while(nI2CStatus[port]== STAT_COMM_PENDING)
  wait1Msec(2);

  CompassPort=port;
}


int HTCompassValue(tSensors port)
{
  int hUpper, hLower, heading;
  TButtons nBtn;

   typedef struct{
    byte nMsgSize;
    byte nDeviceAddress;
    byte nLocationPtr;
    byte nCompassMode;
  } TI2C_Output;

  byte replyMessage[6];

  TI2C_Output sOutput;

     nI2CBytesReady[S3] = 0;
      sOutput.nMsgSize = 2;                            //read the value from the sensor
    sOutput.nDeviceAddress = 0x02;
    sOutput.nLocationPtr = 0x42;
    sendI2CMsg(S3, sOutput.nMsgSize, 6);

    while (nI2CStatus[S3] == STAT_COMM_PENDING)
      wait1Msec(2);

    if (nI2CStatus[S3] == NO_ERR)
    {
      readI2CReply(S3, replyMessage[0], 6);            //get the compass heading

      hUpper = (replyMessage[0] & 0x00FF);
      hLower = (replyMessage[1] & 0x00FF);
      heading = (hUpper << 1) | hLower ;                //convert contents of 0x44 0x45

    }

    return heading;
}

error messages:
35: **Error**:Undefined variable 'sensorI2CCustomStd'. 'short' assumed.
35: *Warning*:Invalid '=' operation for types 'TSensorTypes' and 'short'

:evil: :evil: :evil:

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Fri Jul 25, 2008 2:47 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Jan 31, 2007 3:39 am
Posts: 299
Location: San Diego, California. USA
Post 
In 1.38, sensorI2CCustomStd is not a valid sensor type.

Try sensorI2CCustom and see if that works. There is also a sensorI2CHiTechnicCompass, that may be right up your ally as well.

Hope This Helps
Scott B-)

_________________
Mmmm Legos B-)

My Robot Projects:
http://www.freewebs.com/robotprojects/


Sat Jul 26, 2008 2:08 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 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.