Shop OBEX P1 Docs P2 Docs Learn Events
mpu 6050 problem for atmega 8 — Parallax Forums

mpu 6050 problem for atmega 8

dishadisha Posts: 3
edited 2014-09-01 12:38 in Accessories
i have interfaced a mpu 6050 to my atmega 8 & have written a code using i2c header file.
the code is to see whether the device is accessible or not. and the function used is:
unsigned char i2c_start(unsigned char address)
Issues a start condition and sends address and transfer direction.
return 0 = device accessible, 1= failed to access device
then i am printing the value got on lcd
ex:
#define Dev24C02 0X68   //sensor address
ret=i2c_start(Dev24C02);    //sending device address
  lcd_showvalue(ret);

so ret should either print 0 or 1.
but lcd remains blank (there is no print at all).
i have tested the lcd (it's working all fine with other programs).
I am unable to figure out what is the exact problem..:-(

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-09-01 12:35
    What type of variable does "lcd_showvalue" expect? Does it need to be an ANSII character?

    If so, maybe this would work.
    lcd_showvalue(ret + '0');
    

    I'm not sure if that's proper C lingo or not, but my intention is to change the numeric 0 or 1 to the character "0" or "1".
  • jazzedjazzed Posts: 11,803
    edited 2014-09-01 12:38
    Duane Degn wrote: »
    What type of variable does "lcd_showvalue" expect? Does it need to be an ANSII character?

    If so, maybe this would work.
    lcd_showvalue(ret + '0');
    

    I'm not sure if that's proper C lingo or not, but my intention is to change the numeric 0 or 1 to the character "0" or "1".


    Yup. That would work fine.
Sign In or Register to comment.