Error While writing Library for Gy521
-
@vishnumaiea Thank you. I made the changes, it worked well.
Next, I want to return 3 variables in getAcData() function. Is there any way to do this ? Can i access AcX,AcY,AcZ globally via main code. -
@rafitc99 The member variables of a class can not be accessed without an accompanying object; that's the concept of a class. If you want to return three values, simply update the member variables AcX, Ac and AcZ, and access them as,
Serial.println(goo.AcX); Serial.println(goo.AcY); Serial.println(goo.AcZ);
-
Serial.println(goo.AcX); Serial.println(goo.AcY); Serial.println(goo.AcZ);
while using above code, I'm getting '0'. not updating,
-
@rafitc99 is it fixed ?,u found a solution?
-
@saheen_palayi Nop, while calling goo.AcX getting zero as output. not getting updated value.
-
@rafitc99 I dont think u can access those like that did you tried those lines after
goo.getAcData(); goo.getGyData();
-
@saheen_palayi yeah! that was the problem. Now it's worked. Thank you @saheen_palayi and @vishnumaiea
-
@rafitc99 What was the solution?
-
@salmanfaris forgot to call function
getAcData()
andgetGyData()
beforegoo.AcX
... -
ohh , Glad to know that it's working fine, Thanks to @vishnumaiea and @saheen_palayi .