# Combining XOD to manual write code

**URL:** <https://forum.xod.io/t/combining-xod-to-manual-write-code/490>\
**Category:** Uncategorized\
**Created:** [February 11, 2018, 9:46am UTC](https://forum.xod.io/t/combining-xod-to-manual-write-code/490 "2018-02-11T09:46:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sios](https://avatars.discourse-cdn.com/v4/letter/s/a8b319/32.png) [@sios](https://forum.xod.io/u/sios)\
**Post date:** [February 11, 2018, 9:46am UTC](https://forum.xod.io/t/combining-xod-to-manual-write-code/490/1 "2018-02-11T09:46:50Z")

</div>

Hello  
since i can’t understand how to use RTC in XOD and its a little bit complex if i used XOD i decide to write down the code using IDE  
the problem now is how can i combine XOD with my IDE code?  
note: it;s my firs time coding and i really confused about the structure

---

<div class="post-metadata">

**Author:** ![evgenykochetkov](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/evgenykochetkov/32/14_2.png) [@evgenykochetkov](https://forum.xod.io/u/evgenykochetkov)\
**Post date:** [February 12, 2018, 8:19am UTC](https://forum.xod.io/t/combining-xod-to-manual-write-code/490/2 "2018-02-12T08:19:56Z")

</div>

Hello and welcome!  
We have [this guide](https://xod.io/docs/guide/nodes-for-xod-in-cpp/) about creating nodes for XOD in C++, but I’m not sure if that’s what you mean by “combining XOD with IDE code”.  
Could you please provide a more concrete example of what you are trying to achieve?

---

<div class="post-metadata">

**Author:** ![sios](https://avatars.discourse-cdn.com/v4/letter/s/a8b319/32.png) [@sios](https://forum.xod.io/u/sios)\
**Post date:** [February 12, 2018, 11:31am UTC](https://forum.xod.io/t/combining-xod-to-manual-write-code/490/3 "2018-02-12T11:31:03Z")

</div>

thanks for replaying 🙂 yes the notimplementinXOD is the first thing i do but sadly it can’t work (or maybe i do it wrong)

i will give the explanation in example i hope it can be easily to understand

1. i create some code using XOD and it run well
2. because im confused using the RTC node in XOD i decide to do it manually using arduino IDE ( the code is to control on off a led but with sunrise and sunset feature.)

and finally how can i marge this two code become one?

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [February 12, 2018, 2:44pm UTC](https://forum.xod.io/t/combining-xod-to-manual-write-code/490/4 "2018-02-12T14:44:13Z")

</div>

I think the question is “How do I take XOD code and merge it with code written in arduino IDE?” I think the only answer would be to use Deploy \> Output Code for Arduino from XOD, then insert your arduino IDE code into the appropriate location. I’m sure it would be easier to figure out the C++ code than to do that every time you upload code…

What do you mean by sunrise/sunset feature? Are you turning LED on and off using light sensor, or turning LED on/off slowly? Either should be easily implemented with existing XOD nodes. A light sensor would just be an analog-input that would be used exactly like POT example in the tutorial. If you want the LED to slowly turn on/off, there is a fade node to do just that, also explained in the tutorial.

---

<div class="post-metadata">

**Author:** ![sios](https://avatars.discourse-cdn.com/v4/letter/s/a8b319/32.png) [@sios](https://forum.xod.io/u/sios)\
**Post date:** [February 12, 2018, 3:51pm UTC](https://forum.xod.io/t/combining-xod-to-manual-write-code/490/5 "2018-02-12T15:51:23Z")

</div>

ah so i can manually insert it as long it’s in the right order.

yup slowly turn on and slowly turn off. i already see the fade node but the main problem is with the rtc node i can’t figure how to use it until now (silly i’m)

i already post about it in [How to use ds1307 module?](https://forum.xod.io/t/how-to-use-ds1307-module/316)

BTW the tutorial you mention is it this link [https://xod.io/docs/tutorial/](https://xod.io/docs/tutorial/)?

and the last sorry for my bad English \>.\<

---

<div class="post-metadata">

**Author:** ![evgenykochetkov](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/evgenykochetkov/32/14_2.png) [@evgenykochetkov](https://forum.xod.io/u/evgenykochetkov)\
**Post date:** [February 12, 2018, 4:56pm UTC](https://forum.xod.io/t/combining-xod-to-manual-write-code/490/6 "2018-02-12T16:56:24Z")

</div>

> [@sios](#):
>
> and the last sorry for my bad English \>.\<

No worries 🙂 I’m sure everyone can understand you just fine.

While you are taming the rtc module, I suggest “dialing in” current time with a couple of potentiometers: one for hours and one for minutes(for simplicity’s sake, let’s not worry about seconds etc for now).

Then, you can make a node that calculates a number of minutes since the start of the day(`hours * 60 + minutes`):  
 ![28%20](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/da1238c9b5a5aab80ebf9a939ddddafd6c5ee9f6.png)

…and use it to compare current time with sunset and sunrise:

 ![01%20](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/fa70cf43701b3a5707467626e3e6507b31c4175f.png)

[time-between.xodball](https://forum.xod.io/uploads/xod/original/1X/e5df213ac2f37e659ed03c57e7331b275beab74f.xodball) (13.8 KB)

---

<div class="post-metadata">

**Author:** ![sios](https://avatars.discourse-cdn.com/v4/letter/s/a8b319/32.png) [@sios](https://forum.xod.io/u/sios)\
**Post date:** [February 12, 2018, 5:38pm UTC](https://forum.xod.io/t/combining-xod-to-manual-write-code/490/7 "2018-02-12T17:38:11Z")

</div>

great idea thanks for the enlightenment 😃

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/eb7348baa04192c2ef932d1db54d44f09f8a7888.png) [@system](https://forum.xod.io/u/system)\
**Post date:** [February 25, 2018, 3:48am UTC](https://forum.xod.io/t/combining-xod-to-manual-write-code/490/8 "2018-02-25T03:48:13Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
