Timing a high input pulse


#1

I have an accelerometer (MEMSIC 2125) that puts out a high pulse for a number of ms depending on the tilt it is setting at.
I used a counter in Pbasic which worked perfectly with a 16 bit variable, but with XOD I can not find a way to read
the inputs. Does anyone have any suggestions on how to read the value?
Also is there going to be a library made for (Seeed)Grove devices?

Thanks, Dan C


#2

Hi dancotterell314

See if this helps :smile: Any feedback on your success would be greatly appreciated. (I dont have of one of these to test)
bradzilla84/x2125


#3

Hi Bradzilla84

Thanks for putting this node together for me!

I will try it today.

I do appreciate the time and trouble you put into this for me!

Thanks again, Dan


#4

Hi Bradzilla

I added the lib. and opened the node. I made my connections to the ports and tried to up load, which gave the error below.

I am not sure what I did wrong when I added the library, it was my first time adding a lib.

Arduino dependencies missing You have to install these libraries first: "Mx2125"

Dan


#5

Are you running XOD on windows?
to the right of that error there should be a button “Download and Install”
After that hit Upload again.


#6

Hi again

I am using win 10. I added the lib again and received the same message, but there isn’t a button beside the message. I even moved the inspector to the other side of the screen thinking that it may be hiding the button, but no button. What is the example supposed to do, it opens with no pins?

Confused, Dan


#7

Hmmm Should look like this(The message only stays up for a couple of seconds):


#8

The details Of The patch can be seen here:
https://xod.io/libs/bradzilla84/x2125/mx2125/


#9

The patch is just a quick and dirty wrapper for the MX2125 Library by Aaron Magill to pull all the data in one hit( Rotation Tilt Acceleration Ect… ) If it works I can expand it in to individual readings to reduce overhead in your code.


#10

Hi Bradzilla

I just tried reloading the lib. it loaded but did not flash the install text, I have seen it when ever a new update is available so I know what I am looking for.

I am running the latest XOD ide. I don’t know what I am doing wrong.

I open to any help you can offer.

Dan


#11

No problem I can give you the steps to install it manualy (they are on the forum to). A little later. (at work at the moment)


#12

No problem, I am just off to bed. I will check my email tomorrow morning.
I am to wait, thnaks, Dan


#13

Hey Dan
Go to https://github.com/asmagill/Mx2125 and click the “Clone or Download” Button.
Extract that in to your “C:\Users"Username”\xod_ardulib_\ Directory.
Should look like this.
Untitled

That’s it, Upload now.


#14

Hi Brad

I think I am getting closer to success, this time the “Install” caption / button appeared, I pressed it and all seemed to go well.

Error

I tried the node and this message came up:

Cannot read property ‘@@transducer/step’ of undefined
The error has no formatter, which is a bug. Report the issue to XOD developers.

Still trying, Dan


#15

yea that happens every time with any library :slightly_frowning_face: hit upload again…


#16

Hi Brad

I tried the node again and it up loaded to the Arduino, but I don’t get any read out from the Watch[es].

I checked the connections and the voltages to the Arduino board all are good. The inputs (ports) are correct.

At least no errors!

Any thoughts?

Dan


#17

Hmmm does your patch in example look like this?
Untitled

I just noticed that XOD doesn’t seem to be tracking the version upgrades. (0.25.3 the new one)
Try installing it again from the “Ädd Library” button. you should be on Ver0.0.4


#18

I uploaded the patch, it said the up load was successful (actually uploaded it twice). It is 04 running on 0.25.3, loaded .3 this morning.
Still does not work, I downloaded it to the Arduino 4 times, no readings.

Dan


#19

PS

Oh, the patch does look like the one you have above.


#20

Sorry Dan this is my fault Should have just done it properly the first time :sweat_smile: .
I have changed the patch to Ver 0.0.5 can you test the example for me please if all goes well i will implement the rest of the sensors.