Please help with complex flow controller code
i'm working on arduino-based open source unit control flow in educational river models build -- see www.emriver.com.
having hard time parts of code! the device waterproof box 3 buttons control: up, down, , "aux" button. the arduino inside sends control pulses critical velocity sp-315 pwm unit controls small 12-volt pump. descriptive video here: http://lrrd.blogspot.com/2010/09/our-happy-first-digital-hydrograph.html
i'm having hard time menu program; works pretty well, can't quite figure out how to:
1. call menu "aux" button, got work--
2. use up/down buttons go through choices; got that--
3. third "aux" button select , run function, not return menu program.
i have working, bugs driving me crazy; can't quite grasp how call menu, exit run "hydrograph" routine without coming it; question how out of menurun function good!
in menurun function want call hydrographrun , go loop; i'm doing using while statement.
if run "while menuon =1" , set menuon = 0, exit function , never come back? is there better way?
here's relevant code (too big post here)ftp://. the menurun section 1 i'm having trouble with. many who've helped far.
http://emriver.com/oct_20_working_code_bugs_out_545_copy.txt[timestamp=1287629361]
having hard time parts of code! the device waterproof box 3 buttons control: up, down, , "aux" button. the arduino inside sends control pulses critical velocity sp-315 pwm unit controls small 12-volt pump. descriptive video here: http://lrrd.blogspot.com/2010/09/our-happy-first-digital-hydrograph.html
i'm having hard time menu program; works pretty well, can't quite figure out how to:
1. call menu "aux" button, got work--
2. use up/down buttons go through choices; got that--
3. third "aux" button select , run function, not return menu program.
i have working, bugs driving me crazy; can't quite grasp how call menu, exit run "hydrograph" routine without coming it; question how out of menurun function good!
in menurun function want call hydrographrun , go loop; i'm doing using while statement.
if run "while menuon =1" , set menuon = 0, exit function , never come back? is there better way?
here's relevant code (too big post here)ftp://. the menurun section 1 i'm having trouble with. many who've helped far.
http://emriver.com/oct_20_working_code_bugs_out_545_copy.txt[timestamp=1287629361]
the complex program flow of complex flow controller not obvious code posted (or maybe browser) - indentation insane.
could reformat , repost, please?
at first glance, seem have virtually variables global scope - not helpful. reducing scope , using function parameters make code easier follow.
also, code liberally sprinkled magic number - these difficult understand in few months time.
do have aversion "for" loops?
unless really know you're doing, recursion on arduino bad idea.
you maybe rid of of noise comments too;
rtfm
always align code comment.
could reformat , repost, please?
at first glance, seem have virtually variables global scope - not helpful. reducing scope , using function parameters make code easier follow.
also, code liberally sprinkled magic number - these difficult understand in few months time.
code: [select]
counter = 0;
while(counter < 150)do have aversion "for" loops?
code: [select]
void resetqt()
{
qsum = 0;
reset = millis(); //value subtracted elapsed time
[glow]loop();[/glow]
}unless really know you're doing, recursion on arduino bad idea.
you maybe rid of of noise comments too;
code: [select]
void whatever () { tells start of function called "whatever", there's no need thrash slash key telling that.code: [select]
analogwrite(speakerpin, 400);rtfm
code: [select]
delay (200); // give voltage 3/10 sec stabilizealways align code comment.
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Please help with complex flow controller code
arduino
Comments
Post a Comment