first of all i found and tried the solution in thistopic but it doesn't seems to work.
I'm trying to read the value of x,y,z axis from and MMA7361 accelerometer,the problem is that i keep reading nearly-equal values even if i move the accelerometer in any position.
How i connected it:
Vcc = netduino 3v3 port;
Aref = Vcc;
Gnd= Gnd
X=AnalogInput 5
Y=AnalogInput 4
Z=AnalogInput 3
Here's my code:
SecretLabs.NETMF.Hardware.AnalogInput XPort = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A5); SecretLabs.NETMF.Hardware.AnalogInput YPort = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A4); SecretLabs.NETMF.Hardware.AnalogInput ZPort = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A3); while (true) { //read from input ports float X = XPort.Read(); float Y = YPort.Read(); float Z = ZPort.Read(); //convert to degrees [360*(analogValue/ADCresolution)] X= 360*(X/1024); Y= 360*(Y/1024); Z= 360*(Z/1025); Debug.Print("X: " + X+ "; Y: " + Y+ "; Z: " + Z); }
Now,i keep getting outputs aroud 130-200 no matter how i rotate the accelerometer.
Any idea on why it should be happening?
Thanks.