go_away

Author Topic: Yet Another Webbot LIB question (I2C_Master.h)  (Read 2257 times)

0 Members and 1 Guest are viewing this topic.

Offline AsellithTopic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 648
  • Helpful? 9
  • "I'm a leaf on the wind. Watch how I soar"
Yet Another Webbot LIB question (I2C_Master.h)
« on: January 29, 2010, 05:21:24 PM »
Ok working on my comand unit now to test sending commands to my newly compiled but untested module code. I'm trying to send a command to the unit here is what I have so far.

Code: [Select]
uint8_t sonar_addr = 0xBB;
uint8_t SET_SENSOR_TYPE_EZ1[2] = (0x03,0x01);

boolean ok = i2cMasterSend(sonar_addr, 2, SET_SENSOR_TYPE_EZ1);


ok my questions:

Whats an uint8_t? I am assuming its an unsigned 8 bit length integer but whats the t for?

the second line gets a compile error

../ExMOD.c:37: error: invalid initializer

The function statement calls for const uint8_t* data

The const and the * are throwing me. is this a constant pointer that needs to be setup where I store the data? If so how do I do that?

Thanks

EDIT

Ok I need to learn to program one problem solved. here is my correcly compiled code

Code: [Select]
uint8_t sonar_addr = 0xBB;
uint8_t SET_SENSOR_TYPE_EZ1[2] = {0x03,0x01};

boolean ok = i2cMasterSend(sonar_addr, 2, SET_SENSOR_TYPE_EZ1);

Got to learn how to declare an array

However I now get this error

d:/winavr-20090313/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: cannot find -lWebbot-ATMega640

ideas?
« Last Edit: January 29, 2010, 05:25:30 PM by Asellith »
Jonathan Bowen
CorSec Engineering
www.corseceng.com

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,132
  • Helpful? 108
Re: Yet Another Webbot LIB question (I2C_Master.h)
« Reply #1 on: January 29, 2010, 07:26:05 PM »
Have you included the libraries as discussed in the 'Getting Started with AVRStudio' section of the manual?

The 'const' is there to indicate that the routine you are calling will not change the contents of the array.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline AsellithTopic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 648
  • Helpful? 9
  • "I'm a leaf on the wind. Watch how I soar"
Re: Yet Another Webbot LIB question (I2C_Master.h)
« Reply #2 on: January 29, 2010, 08:13:04 PM »
ok I see the problem. I am using dropbox but evidently it doesn't do what i thought. So it screwed up something between my computers. I almost lost the days works. however after working on the file on two different computers It messed up where the library was pointed as they are not both running the same OS even though dropbox has the files in the documents folders the windows 7 machine has a slightly different path structure. Thanks again webbot.
Jonathan Bowen
CorSec Engineering
www.corseceng.com

 


Get Your Ad Here

data_list