How does the analog output function work to fade LED's?
Is it possible to link sketches instead of having one long sketch?
Where can I find answers to these kind of questions?
How does the analog output function work to fade LED's?
Is it possible to link sketches instead of having one long sketch?
Where can I find answers to these kind of questions?
Are you aware there is a reference section?
Did you Google 'Arduino analogWrite' ?
bobdeutsch:
How does the analog output function work to fade LED's?
For a very simple demonstration have a look at File > Examples > 01.Basics > Fade and the associated tutorial:
https://www.arduino.cc/en/Tutorial/Fade
Note that this example is not ideal if you also want to add in other code due to the use of delay(). You can improve it by applying the skills you will learn by studying File > Examples > 02Digital > BlinkWithoutDelay and the associated tutorial:
https://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
bobdeutsch:
Is it possible to link sketches instead of having one long sketch?
It is possible to break your sketch into multiple files, which are called "tabs" in the Arduino IDE. You do this by clicking the downward pointing triangle on the right side of the Arduino IDE window just above the editor window, then click "New Tab" and enter the desired name. Keep in mind this doesn't allow you to put a separate sketch in each tab but only to split up a single sketch. This is useful for large sketches because it makes it much easier to navigate through your code than scrolling through hundreds of lines. The Arduino IDE concatenates all the .ino files into a single file, in the order they are shown in the Arduino IDE left to right. This is done with the sketch that matches the folder name leftmost, followed by other tabs in alphabetical order. Sometimes it can be problematic to name your tabs as you like while at the same time getting them in the right order. For that reason I name my tab like this example: A10constants, A20globals, A30setup, A40loop, A50functions. That way you can put them in the right order and also give them useful names and you can later insert other tabs anywhere in the sequence without having to rename all of the ones that come after.
bobdeutsch:
How does the analog output function work to fade LED's?
http://www.thebox.myzen.co.uk/Tutorial/PWM.html
Is it possible to link sketches instead of having one long sketch?
You can split a sketch into separate functions, give them meaningful names, and have the main loop function call these. As a rule of thumb no function should be longer than a page in your editor.
If you want to merge two sketches into one then this can get complex depending what you are doing but a doing it by numbers method is given here:-
http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html
Where can I find answers to these kind of questions?
The internet, but be aware of rubbish sites like Instructables.