I am writing a program using Processing and I was already able to import arduino library and everything is working fine. But now I want to get data from the x,y,z using an accelerometer MM7361.
Is it possible to import the AcceleroMMA7361 library for arduino into a processing sketch? If yes, where should I place the library folder and how to include AcceleroMMA7361.h in Processing?
Thanks in advance.
I am writing a program using Processing and I was already able to import arduino library
Which then expects you to upload a Firmata sketch, making the Arduino as stupid as a box of rocks.
But now I want to get data from the x,y,z using an accelerometer MM7361.
That's a shame. That requires that the Arduino be at least somewhat intelligent.
Is it possible to import the AcceleroMMA7361 library for arduino into a processing sketch?
No.
I did upload the firmata sketch PaulS, that's why I said everything was working fine. Thank you for taking the time to answer my question.
Instead, I used both arduino and processing sketches in order to get data from the x,y,z coordinates, was the only alternative I could find. Like that I could use the AcceleroMM7361 library in the arduino sketch.
Hello everybody,
I would like to open up the topic again as I've been trying to integrate StandardFirmata with G_Force (standard accelero MMA7361) that I copy-paste for convenience down below:
#include <AcceleroMMA7361.h>
AcceleroMMA7361 accelero;
int x;
int y;
int z;
void setup()
{
Serial.begin(9600);
accelero.begin(13, 12, 11, 10, A0, A1, A2);
accelero.setARefVoltage(3.3); //sets the AREF voltage to 3.3V
accelero.setSensitivity(LOW); //sets the sensitivity to +/-6G
accelero.calibrate();
}
void loop()
{
x = accelero.getXAccel();
y = accelero.getYAccel();
z = accelero.getZAccel();
Serial.print("\nx: ");
Serial.print(x);
Serial.print(" \ty: ");
Serial.print(y);
Serial.print(" \tz: ");
Serial.print(z);
Serial.print("\tG*10^-2");
delay(500); //make it readable
}
Obviously the above code has been integrated with StandardFirmata into each section ("general", setup(), loop()) with minor modification (removing the trailing delay and setting serial to 57600).
Forget for the moment an use for the above - that will come much, much later...
- what I did expect, at least, was a serial out with x, y, z values BUT the actual values are apparently quite erratic with increasing values .
Apparently, after a new ROM flashing, numbers are unchanging.
Serial:
Calibrating MMA7361011..................................................
DONE
x: -2 y: -2 z: 100 G10^-2
x: -2 y: -2 z: 100 G10^-2
x: -2 y: -2 z: 100 G10^-2
x: -2 y: -2 z: 100 G10^-2
While firmata_test (Main Page - Firmata) shows the attached image.
Anyone could help to integrate MMA7361 within StandardFirmata?
Personally, best for me would be having x, y and z as plain (calculated) result of A0, A1 and A2. Any clue?
For completeness, the running code attached (firmata_modified.txt).
Firmata_test.bmp (933 KB)
firmata_modified.txt (22.1 KB)
The StandardFirmata sketch looks nothing like that. There is NOTHING in that code that knows how to read, or respond to, a Firmata request.
Sorry PauS for the misunderstanding, I've click "save" before actually ending to edit the message.
Current message should be more clear ![]()
It was G_Force output (an example from AcceleroMMA7361) the one shown.
I'm not sure I've express myself - what I really need is a clean data output as comes from AcceleroMMA7361. This would be way handy to be used under Python, which is its final destination. Otherwise, I'm not sure how to handle accelerometers' data under Python (ideas are more than welcome!)
Basically the plot is to have Arduino do the dirty job and giving clean, calculated numbers. Firmata will return the numbers and Python will process on the server side.
Still, I'm gratefully open to suggestions ![]()
[SOLVED]
I'm replying to myself with the code.
Forewords: I had the need to use Firmata AND an MMA7361 accelerometer.
Issue: Data returned from Arduino was, obviously, raw and I rather preferred to have clean G-force data as provided by AcceleroMMA7361.h.
Solution (could be polished but is functional): StandardFirmata with minor modifications to load AcceleroMMA7361 library, calibrate, intercept returning data from Firmata and return calculated X, Y, Z into A0, A1 and A2 instead real values.
For any comment, feel free to post your code. Please: easy on me, I have no clue what Firmata was until yesterday (and still unaware on how it works to some extent..)
![]()
firmata.ino (22.8 KB)