[SOLVED] Help with logic


hello

i making model have arduino mega 2560 r3 controlling 2 stepper motors(with easy drivers)  4 servo motors , 1 solenoid(with tip122 transistor, diode , secondary power source) , 2 led 4 digit displays

the programming aim have 2 separate cycles running @ same time.

the first cycle includes 1 stepper 2 servos , solenoid , second cycle includes stepper , 2 servos

the model of mine shaft
the steppers control location of skip(the elevator car) in shaft
the servos move gates control flow of ore(plastic beads)
2 servos control gate loads skip(one each cycle)
2 servos control gate on storage area(one each cycle)
the skips dump in 2 different ways
the first pushed open solenoid (simulating dump using hydraulic cylinder)
the second moved through set of guides(simulating use of scroll plates dump skip)

the second method of dumping take little longer first method
so 1 cycle 'out perform' other

the number of cycles each side of model completes stored , displayed on 4 digit display , updates after each cycle

for starters want have whole model run pressing button start both cycles @ same time. , have button stop both , reset position of skips , each led display. aim have controlled computer , have graph outputs real time speed of each skip runs through cycle. number of cycles completed displayed on screen aswell. making gui can come after simple version works properly.

i have never used arduino before , have been reading forums 2 weeks figuring out how control devices.

i have attached first draft of code. unsure supposed  to before  and in  startup . draft of timing each process. , lot of proper brackets missing brackets in if statements , semicolons everywhere.

i want make sure understand , have adapted blinkwithoutdelay before move on , put right grammar libraries etc. code.

i havent got arduino , parts in yet dont have definite numbers pins control what. again want make sure im on right track.

thanks in advance

matt


edit: in code put fastmove , slowmove , said times. in fact should number of steps. fast move number of steps takes move skip bottom of scroll plates loading position. , slow move number of steps takes move skip bottom of scroll plate top of scroll plate.

i wouldn't that. instead of doing based solely on time, suggest implement finite state machine each independent thing want control. state machine keep track of current state of thing , determine when action needed based on passing time or other external triggers. robin2 posted example sketch little while ago demonstrated how implement finite state machine included time-based activities.


Arduino Forum > Using Arduino > Programming Questions > [SOLVED] Help with logic


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support