# Timing a high input pulse

**URL:** <https://forum.xod.io/t/timing-a-high-input-pulse/1400>\
**Category:** Uncategorized\
**Created:** [November 21, 2018, 2:21am UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400 "2018-11-21T02:21:57Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![dancotterell314](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@dancotterell314](https://forum.xod.io/u/dancotterell314)\
**Post date:** [November 21, 2018, 2:21am UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/1 "2018-11-21T02:21:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bradzilla84](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/bradzilla84/32/659_2.png) [@bradzilla84](https://forum.xod.io/u/bradzilla84)\
**Post date:** [November 21, 2018, 3:14pm UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/2 "2018-11-21T15:14:25Z")

</div>

Hi dancotterell314

See if this helps 😄 Any feedback on your success would be greatly appreciated. (I dont have of one of these to test)  
[bradzilla84/x2125](https://xod.io/libs/bradzilla84/x2125/)

---

<div class="post-metadata">

**Author:** ![dancotterell314](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@dancotterell314](https://forum.xod.io/u/dancotterell314)\
**Post date:** [November 21, 2018, 6:23pm UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/3 "2018-11-21T18:23:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dancotterell314](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@dancotterell314](https://forum.xod.io/u/dancotterell314)\
**Post date:** [November 21, 2018, 7:19pm UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/4 "2018-11-21T19:19:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bradzilla84](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/bradzilla84/32/659_2.png) [@bradzilla84](https://forum.xod.io/u/bradzilla84)\
**Post date:** [November 21, 2018, 9:42pm UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/5 "2018-11-21T21:42:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dancotterell314](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@dancotterell314](https://forum.xod.io/u/dancotterell314)\
**Post date:** [November 21, 2018, 10:30pm UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/6 "2018-11-21T22:30:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bradzilla84](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/bradzilla84/32/659_2.png) [@bradzilla84](https://forum.xod.io/u/bradzilla84)\
**Post date:** [November 21, 2018, 10:40pm UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/7 "2018-11-21T22:40:47Z")

</div>

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

 ![Untitled](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/868ffb8ad1e23ba4a42804c6123eb88926eeb065.jpeg)

---

<div class="post-metadata">

**Author:** ![bradzilla84](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/bradzilla84/32/659_2.png) [@bradzilla84](https://forum.xod.io/u/bradzilla84)\
**Post date:** [November 21, 2018, 10:54pm UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/8 "2018-11-21T22:54:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bradzilla84](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/bradzilla84/32/659_2.png) [@bradzilla84](https://forum.xod.io/u/bradzilla84)\
**Post date:** [November 22, 2018, 12:54am UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/9 "2018-11-22T00:54:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dancotterell314](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@dancotterell314](https://forum.xod.io/u/dancotterell314)\
**Post date:** [November 22, 2018, 1:45am UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/10 "2018-11-22T01:45:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bradzilla84](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/bradzilla84/32/659_2.png) [@bradzilla84](https://forum.xod.io/u/bradzilla84)\
**Post date:** [November 22, 2018, 6:47am UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/11 "2018-11-22T06:47:37Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![dancotterell314](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@dancotterell314](https://forum.xod.io/u/dancotterell314)\
**Post date:** [November 22, 2018, 7:36am UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/12 "2018-11-22T07:36:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bradzilla84](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/bradzilla84/32/659_2.png) [@bradzilla84](https://forum.xod.io/u/bradzilla84)\
**Post date:** [November 22, 2018, 9:30am UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/13 "2018-11-22T09:30:10Z")

</div>

Hey Dan  
Go to [https://github.com/asmagill/Mx2125](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](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/8d0eaf222dc70333e06b87a4a84a2ab1c93a4b65.jpeg)

That’s it, Upload now.

---

<div class="post-metadata">

**Author:** ![dancotterell314](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@dancotterell314](https://forum.xod.io/u/dancotterell314)\
**Post date:** [November 22, 2018, 4:23pm UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/14 "2018-11-22T16:23:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bradzilla84](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/bradzilla84/32/659_2.png) [@bradzilla84](https://forum.xod.io/u/bradzilla84)\
**Post date:** [November 22, 2018, 4:36pm UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/15 "2018-11-22T16:36:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dancotterell314](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@dancotterell314](https://forum.xod.io/u/dancotterell314)\
**Post date:** [November 22, 2018, 4:37pm UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/16 "2018-11-22T16:37:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bradzilla84](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/bradzilla84/32/659_2.png) [@bradzilla84](https://forum.xod.io/u/bradzilla84)\
**Post date:** [November 22, 2018, 5:00pm UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/17 "2018-11-22T17:00:44Z")

</div>

Hmmm does your patch in example look like this?  
 ![Untitled](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/37f163f656afa946819fdaed5df8f7a4b9d396d6.jpeg)

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

---

<div class="post-metadata">

**Author:** ![dancotterell314](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@dancotterell314](https://forum.xod.io/u/dancotterell314)\
**Post date:** [November 22, 2018, 5:22pm UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/18 "2018-11-22T17:22:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dancotterell314](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@dancotterell314](https://forum.xod.io/u/dancotterell314)\
**Post date:** [November 22, 2018, 5:23pm UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/19 "2018-11-22T17:23:44Z")

</div>

PS

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

---

<div class="post-metadata">

**Author:** ![bradzilla84](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/bradzilla84/32/659_2.png) [@bradzilla84](https://forum.xod.io/u/bradzilla84)\
**Post date:** [November 23, 2018, 10:43am UTC](https://forum.xod.io/t/timing-a-high-input-pulse/1400/20 "2018-11-23T10:43:12Z")

</div>

Sorry Dan this is my fault Should have just done it properly the first time 😅 .  
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.

[Next page](https://forum.xod.io/t/timing-a-high-input-pulse/1400.md?page=2)
