I wanted to find out a more easy or intuitive way for programming with Arduino.
For example is there software that allows me to write code from topology block layout to arduino?
I will probably have to assign specifications to each block where needed but it will give me a far better view on how things work, especially if this is a program that have many things to take care at once.
Something like that graphical programming but more simple with a bigger view. I don't like the structure.
I added a small sample in the link below on how it should look. Something like this I am looking for.
So you only need to deal with logic and knowing your setup of course.
For special components or parts on the setup you would also be able to assign libraries or drivers inside those blocks etc etc...
The answer is NO, I have no idea.
I was just thinking to find more intuitive ways to compile programs for arduino or other interfaces.
This would be useful when having many different variables. You could also just load code into those blocks.
So the layout is about linking different code chunks together and assigning them to a logic gate or something like that .. not sure ..
It’s done all the time in other industries. See function block plc programming (part of IEC 61131), state machine programming and it is also used extensively in process control systems. These programs are usually part a very large overall system with lots of computing power, both to create and to execute those programs.
Arduino does not fit that paradigm. If you want to use $20 embedded controllers, you’d best resign yourself to learning C and C++. While you could create a graphical programming environment for Arduino, and in fact they have been created, their actual usefulness is quite limited compared to what can be done with more conventional tools.
Ok ...
My next question in this case would be. Can you assign a name for '' a part '' of arduino code ?
LEt's say you written all these chunks of codes for each individual block. Is it possible to call them by referring to a word or phrase or whatever .. What I am trying to accomplish. You write all the code for all those blocks, assign them a name and then write the general code by referring to them with those names.
Even with the example in post #1 has some structure and an order of doing things,
Your posted example shows no logical flow.
You MUST load the servo library first, then setup input and output ports, then iinitialize the servo, then read a button, then drive the servo.
I am not sure what your posted example is supposed to do.
ChrisTenone:
Writing a flow chart compiler would be a real fun project tho ...
The thing in the OP's diagram is not a flow chart. It is just a list of components and libraries without any indication of what anything is supposed to do.
Robin2:
The thing in the OP's diagram is not a flow chart. It is just a list of components and libraries without any indication of what anything is supposed to do.
...R
Right!
A flow chart is unambiguous. Here is an old school flow chart for reading an RTC and displaying the time: @OP, notice how each instruction is sequenced, and every line has a direction?
Anghel_Alexandru:
Ok ...
My next question in this case would be. Can you assign a name for '' a part '' of arduino code ?
LEt's say you written all these chunks of codes for each individual block. Is it possible to call them by referring to a word or phrase or whatever .. What I am trying to accomplish. You write all the code for all those blocks, assign them a name and then write the general code by referring to them with those names.
greets
your minimum sketch is to have a setup() and a loop() function
but, you can create other functions
temperature()
read soil temperature
read refrigerator temperature
read air temperature
and so on.
display()
write temperatures to the display
so, you can have a long page that is chunks that are functions.
if you go into your operating system, outside of the arduino IDE
and copy your program.ino to display.ino
then you would have two .ino files.
now when you open your sketch, there are two tabs.
click on display.ino and there you put
display() {
// your display code
} // end of display
you can make another one called temperature() and have a 3rd tab.
go into your main program that has the only copy of setup() and loop()
and in loop() put
loop() {
temperature()
display()
} // end of loop
your main program will be much shorter and your functions will be on other tabs.
when it compiles, it treats them all as if they were one long file.
Good. That is a neat framework which shows how all the components of your final program are going to fit together. But you can't just load that into the Arduino and expect it to know all the other stuff that is in your brain.
The top-right has a box for "servo initial position". What is the position? You have to give the compiler an actual number. This box needs a space to write the number.
Under that you have "servo limits". Once again you need numbers. You also need to tell it what to do: should it just stop or flash a light or sound a buzzer?
When you put a complete programming language into graphical form like this, each box ends up quite large with lots of details inside it. The diagram no longer fits on one page. So you cannot look at the whole diagram and understand the whole program.
The other problem with graphical languages is they can only do what the designer thought of. It is difficult to add new abilities. If the language doesn't include a box for something like an IMU sensor then you can't add it. When the original Arduino designers created the system in the 2000's, they did not know that thousands of those sensors would become available very cheaply.
The wonderful thing about Arduino is that it can be used to make a gigantic number of projects that the original designers could not have thought of.
Guys it was just a question to get a rough idea how this could work out.
The diagram I made it in 5 minutes I didn't even intend to use something like this and I'm sure it's far from perfect. This was pure for setting an example of what I had in mind.
The purpose of this question was to find out if there is anything already like this out there for me to use in order to write codes more easily for Arduino.
Doing something like this myself sounds like fun but I don't have the knowledge yet.
Also, this seems more logical to learn how to write programs if one would start from this approach instead of the code directly and all those prefixes etc etc .. One could than break this blocks/chunks of code and go deeper inside it to see the code itself if one must. In my opinion this would make people learn much faster how to write programs.
Anghel_Alexandru:
Also, this seems more logical to learn how to write programs if one would start from this approach instead of the code directly and all those prefixes etc etc .. One could than break this blocks/chunks of code and go deeper inside it to see the code itself if one must. In my opinion this would make people learn much faster how to write programs.
The problem with all of that is that the microprocessor only understands assembly language - which is even more arcane than C++. Effectively the C++ compiler turns the C++ code into the specific assembly language that the microprocessor understands.
So before you can get even one of your blocks to do anything useful someone needs to know how to write the program (without using blocks) to convert the block into assembly language - or, perhaps, to convert it into C++ so that the regular compiler can work on it.
A reasonable analogy is that Charlotte Bronte could not have written Jane Eyre without knowing how to speak, how to spell and how to write the letters of the alphabet. Your concept seems like if she was trying to publish a book just from an idea in her head about how people behave.