tide sim

Do you have a question on how to do something.
Ask in here.
Post Reply
james
Posts: 3
Joined: Wed Jan 14, 2015 5:20 am

tide sim

Post by james »

i want to use the tide library to control my return pump with a arduino nano.
i just don't know how to go about using it in my program.
do i need to include moon also? its a stand alone thing just runs the return pump speed.
thanks
james
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: tide sim

Post by lnevo »

The tide class is a standalone, you don't need moon. It will return a wave that increases and decreases by default twice a day. The main thing it does is change the amplitude of the wave based on the phase of the moon. During new moons and half moon the high and low will be small and during full moon and quarter moon the difference between high and low will be greater depending on your settings..

However I don't think this is wise to use on a return pump. Varying the speeds throughout the day will mess with the level of water in your return chamber and most likely be a pain for your ATO. Also most drains in order to be silent are tuned for a specific flow rate. But it depends on your system. Your free to try it out and see how it works. Let me know what questions you have.
james
Posts: 3
Joined: Wed Jan 14, 2015 5:20 am

Re: tide sim

Post by james »

i am not getting this, i tried to just do a simple test program what am i doing wrong?

Code: Select all

 #include <Wire.h>
#include <Time.h>
#include <Tide.h>


int pump = 13;
Tide tide;



void setup(){
  pinMode (pump,OUTPUT);
  tide.Init(50,5,20);
tide.SetWaveLength(12*SECS_PER_HOUR); // This is the default wavelength
}

void loop()
{
  tide.CalcSpeed();
  
  
  pump = CalcSpeed();
} 
here is the errors i get

Code: Select all

Arduino: 1.0.6 (Windows 7), Board: "Arduino Nano w/ ATmega328"
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -IC:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\variants\eightanaloginputs -IC:\Program Files (x86)\Arduino\libraries\Wire -IC:\Users\Owner\Documents\Arduino\libraries\Time -IC:\Users\Owner\Documents\Arduino\libraries\Tide C:\Users\Owner\AppData\Local\Temp\build8955210389605432914.tmp\sketch_jan29e.cpp -o C:\Users\Owner\AppData\Local\Temp\build8955210389605432914.tmp\sketch_jan29e.cpp.o 

In file included from sketch_jan29e.ino:3:
C:\Users\Owner\Documents\Arduino\libraries\Tide/Tide.h:5:21: warning: Globals.h: No such file or directory
In file included from sketch_jan29e.ino:6:
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Arduino.h:47:1: warning: "PI" redefined
In file included from sketch_jan29e.ino:3:
C:\Users\Owner\Documents\Arduino\libraries\Tide/Tide.h:3:1: warning: this is the location of the previous definition
In file included from sketch_jan29e.ino:3:
C:\Users\Owner\Documents\Arduino\libraries\Tide/Tide.h:20: error: 'boolean' does not name a type
C:\Users\Owner\Documents\Arduino\libraries\Tide/Tide.h:21: error: 'boolean' does not name a type
C:\Users\Owner\Documents\Arduino\libraries\Tide/Tide.h:30: error: 'boolean' does not name a type
sketch_jan29e.ino: In function 'void loop()':
sketch_jan29e:19: error: 'class Tide' has no member named 'CalcSpeed'
sketch_jan29e:22: error: 'Calcspeed' was not declared in this scope
without time.h i don't know how that got in there

Code: Select all

Arduino: 1.0.6 (Windows 7), Board: "Arduino Nano w/ ATmega328"
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -IC:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\variants\eightanaloginputs -IC:\Program Files (x86)\Arduino\libraries\Wire -IC:\Users\Owner\Documents\Arduino\libraries\Tide C:\Users\Owner\AppData\Local\Temp\build4448538848442249181.tmp\sketch_jan29a.cpp -o C:\Users\Owner\AppData\Local\Temp\build4448538848442249181.tmp\sketch_jan29a.cpp.o 

In file included from sketch_jan29a.ino:3:
C:\Users\Owner\Documents\Arduino\libraries\Tide/Tide.h:5:21: warning: Globals.h: No such file or directory
In file included from sketch_jan29a.ino:6:
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Arduino.h:47:1: warning: "PI" redefined
In file included from sketch_jan29a.ino:3:
C:\Users\Owner\Documents\Arduino\libraries\Tide/Tide.h:3:1: warning: this is the location of the previous definition
In file included from sketch_jan29a.ino:3:
C:\Users\Owner\Documents\Arduino\libraries\Tide/Tide.h:20: error: 'boolean' does not name a type
C:\Users\Owner\Documents\Arduino\libraries\Tide/Tide.h:21: error: 'boolean' does not name a type
C:\Users\Owner\Documents\Arduino\libraries\Tide/Tide.h:30: error: 'boolean' does not name a type
sketch_jan29a.ino: In function 'void setup()':
sketch_jan29a:14: error: 'SECS_PER_HOUR' was not declared in this scope
sketch_jan29a.ino: In function 'void loop()':
sketch_jan29a:19: error: 'class Tide' has no member named 'CalcSpeed'
sketch_jan29a:22: error: 'Calcspeed' was not declared in this scope
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: tide sim

Post by lnevo »

Use the wizard and grab all the standard includes. Globals.h is probably the most important one you are missing.
james
Posts: 3
Joined: Wed Jan 14, 2015 5:20 am

Re: tide sim

Post by james »

nope that just made a big mess, to big tried to take some stuff out. errors. i don't want to track down all of the problems there must be an easier way.i guess ill try to just go from 0/255 twice a day and move it up an hour everyday
thanks anyway.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: tide sim

Post by lnevo »

No just need the includes not all the code. If your able to compile a normal ra code then you could just use the GyreMode or SineMode functions. You could also if you need it really small just copy the SineMode function into your INO
Post Reply