Skip to main content

Hamish Campbell

Hamish Campbell's Public Library

Dec 25, 12

" index = 0;

totalX = 0;
totalY = 0;
totalZ = 0;

averageX = 0;
averageY = 0;
averageZ = 0;

while (index < numReadings)
{
totalX = totalX - readingsX[index];
totalY = totalY - readingsY[index];
totalZ = totalZ - readingsZ[index];

readingsX[index] = analogRead(xaxis);
readingsY[index] = analogRead(yaxis);
readingsZ[index] = analogRead(zaxis);

totalX = totalX + readingsX[index];
totalY = totalY + readingsY[index];
totalZ = totalZ + readingsZ[index];

++index;
}

index = 0;

averageX = totalX / numReadings
averageY = totalY / numReadings
averageZ = totalZ / numReadings

x = averageX;
y = averageY;
z = averageZ;
"

1 - 20 of 250 Next › Last »
20 items/page

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo