Coding question

New members questions
Post Reply
GTi_Leo
Posts: 17
Joined: Tue Apr 30, 2013 5:38 pm
Location: Toronto Canada

Coding question

Post by GTi_Leo »

so i'm new to the reef angel coding thing, i've done a bit of computer programming in the past and generally all the functions of the program have to be coded for the programs to work.

been going through the preleaded code that comes with the RA install pack and there isn't much code to it, no if funtions or PWM graphs no timming functions or anything

are all these setiiong programmed elsewere, i'd like to get a better understanding of how things are coded in the Arduino world so i can grasp the RA programming better

thanks
leo

PS: ive got my WiFi adapter all hooked up and working but when i go to my portal all it says is connecting under the connection status any ideas? the Android app is working and i am able to connect on an outside web browser with IP connection but the portal just hasn't connected
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Coding question

Post by rimai »

Yes, all the underlying code is done under the hood in our libraries.
The files are located in \Documents\Arduino\libraries
You will see a bunch of files. That's all the code that runs behind the scenes :)
To get the Portal going, you need to add the Portal function. The preloaded code doesn't have it.
You need this just above ReefAngel.ShowInterface();

Code: Select all

ReefAngel.Portal("GTi_Leo");
This will instruct the controller to start sending data to the portal every 5 minutes to create the graphs, history and send alerts if you have any trigger setup.
This will also tell the portal what your latest wan ip is. Kinda like a dynamic dns service.
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Coding question

Post by binder »

all of the code is stored in the libraries. the sketches just group the code together. if you want to see all the underlying code, look in your Documents/arduino folder. that's where all the "good stuff" is hidden.

Sent from my Nexus 7
GTi_Leo
Posts: 17
Joined: Tue Apr 30, 2013 5:38 pm
Location: Toronto Canada

Re: Coding question

Post by GTi_Leo »

rimai wrote:Yes, all the underlying code is done under the hood in our libraries.
The files are located in \Documents\Arduino\libraries
You will see a bunch of files. That's all the code that runs behind the scenes :)
To get the Portal going, you need to add the Portal function. The preloaded code doesn't have it.
You need this just above ReefAngel.ShowInterface();

Code: Select all

ReefAngel.Portal("GTi_Leo");
This will instruct the controller to start sending data to the portal every 5 minutes to create the graphs, history and send alerts if you have any trigger setup.
This will also tell the portal what your latest wan ip is. Kinda like a dynamic dns service.

i have done this and put the key in as well it doesn't say unreachable anymore since i have put the portal code in but where it says connection status it simply just says connecting. and i'm having issues now with the pagesnot refreshing even under my own network. not sure if its losing connectivity or not but its not like my controller is far from my router its only 15' away. my guess is thats whats causing the portal to not connect. i may try refreshing the wifi attachment and giving it another go

portal settings is also always changing the port from 2000 to 000
Last edited by GTi_Leo on Wed Jan 08, 2014 11:26 am, edited 1 time in total.
GTi_Leo
Posts: 17
Joined: Tue Apr 30, 2013 5:38 pm
Location: Toronto Canada

Re: Coding question

Post by GTi_Leo »

ao all the commands listed at the beginning open all the functions in the different library sketches

so if i wanted to alter things for the functions it would have to be done in these sketches or create a new one and update the code wit hthe new sketch?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Coding question

Post by rimai »

Correct, but changing the libraries is usually not a good practice, because when an update is released, you would loose the code changes you have made.
If you really want to change something, the best is to simply create a function inside your own ino code and simply call it from within loop().
If you would like something changed in the libraries, you can fork out libraries from github, enhance it and send us a pull request. This will send us a notification that you want something merged in the libraries.
Our github is here:
https://github.com/reefangel/Libraries
If you are changing something in there, use the dev branch, because the master branch is used as released versions and the dev branch is used for stuff that will be released.
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Coding question

Post by rimai »

I don't know if you read this:
http://forum.reefangel.com/viewtopic.php?f=14&t=3353
But, it gives you a brief explanation of how things work.
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Coding question

Post by lnevo »

I would ask, what is it your trying to do... most of the functions in the libraries don't need to be modified. There's usually ways without doing that to get what you are trying to do.

Also, take a look at the Doxygen output on my website http://www.easte.net/ra/html for documentation on all the files and search on different functions.

Most of the behavior can be changed by setting variables in different memory locations that are used by the functions in the libraries. Most of them can be changed via the portal under Internal Memory.
GTi_Leo
Posts: 17
Joined: Tue Apr 30, 2013 5:38 pm
Location: Toronto Canada

Re: Coding question

Post by GTi_Leo »

not really trying to do anything, just curious how things are coded so i have a better knowledge of the working of the RA controller.

i'm sure most of what i want to do is already out there and source code has already been written for such things.
from the standard RA settings i'm probably goign to end up removing the built in wavemaker feature as i am probably goign to end up getting a WP40 and a PWM expansion to control it, also will probably end up removing the daylight and actinic relays as i'm using the PWM outputs to control my LEDs.i may also incorperate some sort of auto waterchange feature, but i haven't decided on that yet
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Coding question

Post by rimai »

Have you tried the wizard?
On Arduino IDE, go to menu Tools->Reef Angel Wizard
Roberto.
GTi_Leo
Posts: 17
Joined: Tue Apr 30, 2013 5:38 pm
Location: Toronto Canada

Re: Coding question

Post by GTi_Leo »

rimai wrote:Have you tried the wizard?
On Arduino IDE, go to menu Tools->Reef Angel Wizard
no i didn't even know it was heere thanks roberto
Post Reply