I just recently got a Hitechnic Accel sensor. I have looked around a lot, but I still can't find out how to read all inputs from the sensors. I know SensorValue() won't work. What is used to get all information from the Accel Sensor?

Also, I have tried the sample program for the Sensor, but it won't compile. Here is the Code:

/** * hitechnic-accelerometer.h provides an API for the HiTechnic Acceleration Sensor. This program * demonstrates how to use that API. * * Changelog: * - 0.1: Initial release * - 0.2: Make use of new API calls * - 0.3: Better comments * - 0.4: Fixed display line (thanks Dave) * - 0.5: Removed single axis functions, they're no longer in the driver\n * Removed common.h from includes * * Credits: * - Big thanks to HiTechnic for providing me with the hardware necessary to write and test this. * * License: You may use this code as you wish, provided you give credit where it's due. * * THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 4.10 AND HIGHER

**Severe*:Couldn't open '#include' file 'hitechnic-accelerometer.h' (Line 28)**Error**:Undefined variable 'tHTAC'. 'short' assumed.**Error**:Expected->';'. Found 'accelerometer'**Error**:Undefined variable 'accelerometer'. 'short' assumed.*Warning*:Meaningless statement -- no code generated**Error**:Undefined procedure 'initSensor'.**Error**:Undefined procedure 'readSensor'.**Error**:'accelerometer' is not a reference to a 'struct'**Error**:')' missing. Ummatched left parenthesis '('**Error**:Expected->')'. Found 'x'**Error**:Expected->';'. Found 'x'**Error**:Undefined variable 'x'. 'short' assumed.**Error**:Expected->';'. Found ','**Error**:Unexpected ',' during parsing**Error**:Expected->';'. Found 'y'**Error**:Undefined variable 'y'. 'short' assumed.**Error**:Expected->';'. Found 'z'**Error**:Undefined variable 'z'. 'short' assumed.**Error**:Missing ';' before ')'**Error**:Unexpected ')' during parsing*Warning*:Meaningless statement -- no code generated**Error**:'accelerometer' is not a reference to a 'struct'**Error**:')' missing. Ummatched left parenthesis '('**Error**:Expected->')'. Found 'axes'**Error**:Expected->';'. Found 'axes'**Error**:Undefined variable 'axes'. 'short' assumed.**Error**:LValue for '[]' operator must be a pointer**Error**:'[]' operator requires pointer value on left hand side [2].**Error**:Expected->';'. Found ','**Error**:Unexpected ',' during parsing**Error**:Missing ';' before ')'**Error**:Unexpected ')' during parsing*Warning*:Meaningless statement -- no code generated

Is the sample code outdated, or is there something else wrong?I would really appreciate it if you could tell me how to read all the outputs from the Hitechnic Accelerometer/Tilt Sensor.Thank you!

Mon Dec 28, 2015 6:21 pm

Tabor473

Moderator

Joined: Tue May 19, 2015 3:07 pmPosts: 91

Re: HTAC--HiTechnic Accelerometer/Tilt Sensor Help

So where did you put the.h file?

Mon Dec 28, 2015 7:44 pm

RobotLego

Rookie

Joined: Sun Dec 27, 2015 7:50 pmPosts: 11

Re: HTAC--HiTechnic Accelerometer/Tilt Sensor Help

To tell the truth, I really don't know. I don't think I even have the file. I'm mainly trying to figure things out, so I don't know much.So, what is the file, where should it be, and where can I find it?

Mon Dec 28, 2015 9:18 pm

Tabor473

Moderator

Joined: Tue May 19, 2015 3:07 pmPosts: 91

Re: HTAC--HiTechnic Accelerometer/Tilt Sensor Help

Okay so what is happening is there is an additional file required to work the sensor. The first error you have is ROBOTC saying it can't fine the file, the rest of the errors are because ROBOTC can't find the functions and variables the file would have created.

All right, that makes sense. The program is trying to "#include" the "hitechnic-accelerometer.h".

However, I have that file, and it seems to be in the right folder too. That is, the example program is in 3rd Party Driver Library/examples and the .h file is in 3rd Party Driver Library/include. I tried copying the .h file into the examples folder, but the program still could not find it.

What file are you specifically talking about, the "hitechnic-accelerometer.h" file, or others?And what folder do you mean? Both example and include files are in the 3rd Party Driver Library folder, but they are not both in example or include.

Wed Dec 30, 2015 11:54 am

RobotLego

Rookie

Joined: Sun Dec 27, 2015 7:50 pmPosts: 11

Re: HTAC--HiTechnic Accelerometer/Tilt Sensor Help

Okay, I moved all the "include" files to the "example" folder and the program seemed to work fine. Thank you for your help!One more thing, is there someplace that I can learn about advanced robotC programming, such as stucts, #include, #define, and other things not explained in robotC Help?Thanks again.

Wed Dec 30, 2015 6:14 pm

Tabor473

Moderator

Joined: Tue May 19, 2015 3:07 pmPosts: 91

Re: HTAC--HiTechnic Accelerometer/Tilt Sensor Help

RobotLego wrote:

Okay, I moved all the "include" files to the "example" folder and the program seemed to work fine. Thank you for your help!One more thing, is there someplace that I can learn about advanced robotC programming, such as stucts, #include, #define, and other things not explained in robotC Help?Thanks again.

Okay so I hadn't realized it was in the include folder. Off the top of my head I can't remember how to ensure it is included. I will look into it later today and get back to you. Just to make sure the solution is a little cleaner.

I will also look around for a good resource for more advanced techniques. For the most part ROBOTC acts very much like the C standard so tutorials for arduino etc will all give a good backround explanation.

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