I'm trying to use sonar function for my obstacle avoiding project. But I cant fix this compile error . Please help me ,,
ERROR:
Sensors.cpp: In function 'uint16_t i2c_readReg16(int8_t, int8_t)':
Sensors.cpp:1673: error: cannot convert 'uint8_t (*)[2]' to 'uint8_t*' for argument '3' to 'void i2c_read_reg_to_buf(uint8_t, uint8_t, uint8_t*, uint8_t)'
RELATED FUNCTIONS:
uint16_t i2c_readReg16(int8_t addr, int8_t reg) {
uint8_t b[2];
i2c_read_reg_to_buf(addr, reg, &b, sizeof(b));
return (b[0]<<8) | b[1];
}
void i2c_read_reg_to_buf(uint8_t add, uint8_t reg, uint8_t *buf, uint8_t size) {
i2c_rep_start(add<<1); // I2C write direction
i2c_write(reg); // register selection
i2c_rep_start((add<<1) | 1); // I2C read direction
uint8_t *b = buf;
while (size--) {
/* acknowledge all but the final byte */
*b++ = i2c_read(size > 0);
}
}
Coding Error in Sonar function
Re: Coding Error in Sonar function
Try to modify to:
i2c_read_reg_to_buf(addr, reg, b, sizeof(b));
or
i2c_read_reg_to_buf(addr, reg, &b[0], sizeof(b));
( Those two C lines are strictly the same ! )
Patrick
i2c_read_reg_to_buf(addr, reg, b, sizeof(b));
or
i2c_read_reg_to_buf(addr, reg, &b[0], sizeof(b));
( Those two C lines are strictly the same ! )
Patrick
error while connecting to multiwii gui 2.3
hello everyone...
iam new here and i am working on ublox gps with multiwii 2.3 and while connecting to multiwii gui 2.3 its showing error that "unhandelled expression...value 255 should be between minimum and maximum value."
please help me out in this guys..
or mail me the solution on my id :- kzbr1993@gmail.com
thankyou
iam new here and i am working on ublox gps with multiwii 2.3 and while connecting to multiwii gui 2.3 its showing error that "unhandelled expression...value 255 should be between minimum and maximum value."
please help me out in this guys..
or mail me the solution on my id :- kzbr1993@gmail.com
thankyou