Combining XOD to manual write code


#1

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


#2

Hello and welcome!
We have this guide 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?


#3

thanks for replaying :slight_smile: 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?


#4

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.


#5

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?

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

and the last sorry for my bad English >.<


#6

No worries :slight_smile: 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

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

time-between.xodball (13.8 KB)


#7

great idea thanks for the enlightenment :smiley:


#8

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