Go Down

Topic: Noob Programming Question (Read 648 times) previous topic - next topic

Hello, Im sure its been asked before but I cannot seem to find the answer im looking for in the search.   How do you/ Is it possible to  use multiple codes  in arduino.   I have seen some code where  there is a few snippets on different sketches that are used together in arduino.   I kinda just need a nudge in the right direction or a lil explanation of  how to include a seperate sketch in the main script.

Lol im sure yall are shaking your head but this is my super basic explanation of my needs or idea.

I want one script to be a controller type script for other scripts.   Similar to HTML & CSS where  they feed off eachother for a complete script.  Thank you very much. I dont really need a huge explanation Im just to cheap to buy a book at this point in time lol Thank you.

Arrch

How do you/ Is it possible to  use multiple codes  in arduino.

Yes, it is possible that multiple pieces of code in a single sketch.

Quote
Lol im sure yall are shaking your head but this is my super basic explanation of my needs or idea.

It's more of an extremely broad question that can really only be answered with "it depends on what you're trying to do"

Quote
I want one script to be a controller type script for other scripts.   Similar to HTML & CSS where  they feed off eachother for a complete script.  Thank you very much. I dont really need a huge explanation Im just to cheap to buy a book at this point in time lol Thank you.

What scripts?

jraskell

Grumpy Mike put together a decent guide to merging code:
http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html

It's not nearly as simple/trivial as web based scripts, but it can be done.

tuxduino

Quote
I want one script to be a controller type script for other scripts.


What do you mean exactly ?

In all honesty I dont know what im tryin to do yet. I am still very basic with very little programming experience but I have a good understanding. I can read code pretty well, just not write it.  Im kinda in the stage of brainstorming a project and I was just curious as to whats possible and how i should approach anything. I love the idea of having seperate sketches for 1 program as it gives it clarity in a way. I have book marked the article bout merging code and I greatly appreciate your help.   Im glad to be a member of this forum.

tuxduino

When I was moving my first steps with Arduino (and I've not finished yet ;-) ) I used this approach: write a test sketch that exploited a new feature / library / "thing" I wanted to study and learn how to use in my programs, and nothing else. I tried to keep these "single function" sketches as simple as possible. As soon as I felt comfortable in using this new (for me) Arduino feature or library, I stopped using that sketch, to avoid "polluting" it with the new ideas that came to mind.

I don't really copy code snippets from those sketches inside bigger, "real" programs, but I often copy their structure, or use them to easily remember how to use a library that I haven't touched in a while.

This is my single cent :-)

Go Up