Created a 2D workflow for my sketch, no idea how to structure it

Looking at the screenshots below (I really apologize for the small font) how would I even begin to structure this sketch? What would that even look like? A whole bunch of nested "if" statements?

I've already written, compiled and physically tested each function individually; everything works as intended. However, I have no idea how to actually structure my code so that my machine will work as laid out in the 2D workflow.

Well I guess you shall take view into the IPO model.

Your flowchart, while a little unconventional is a good place to start.

The inputs are going to be switches of some type (push buttons, optical, or micro switches etc)

The servos (unless they’re something else) are actuators / motors of some type.

The logic flow is basically there, then you glue some logic around your detailed functionality.

Remember to build incrementally - getting each subsystem to work on its own. Functions() and arrays[] are useful for making your project modular and easier to maintain.

Thanks for the input @paulpaulson and @lastchancename.

So I already have my code written. I’m just having difficulty understanding how to “organize” everything. I don’t know how I’d go about properly nesting all my functions into one another.

What nesting? You have sequential logic.

@aarg ”nesting” = basically putting a whole bunch of if statements inside one another.

Random Example:

//If the LED is ON
If(LED == ON)
//If the LED is ON and the button is pressed
If(LED == ON && Button_Press == true)
//Do something here

@paulpaulson I was researching what you suggested (IPO models) and came across something called a “finite state machine”. It sounds like the same thing you were talking about with the IPO’s. Thanks for pointing me in the right direction!

Here is a link to an instructibles page that describes how to use “Yukindu” (free software) that does all this automatically.

Many thanks for your feed back.
Have a nice day and enjoy coding.

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