How can I use two exemples in ESP32?
For example I have a code with LED with webserver ( Módule 4 Unit 2) and wanna make store value of the state of the LED ( Módule 2 Unit 7) .
Can I just fuse the sections of the two codes ?
( Outside the LOOP with Outside the LOOP , and Inside the LOOP with Inside the LOOP )
In general, you are taking the right approach. Start with the #include and global variable section. Check the setup() items and merge them together, being watchful of GPIO confilcts which may need to be updated for your board. The Loop() section can be merged also, but you may need to make considerations for and delay() or sleep() calls involved.
That’s exactly what SDBurton said. Also, pay attention to variable definitions that may conflict.
Try it for yourself and see what you get. If you get any errors or weird behavior and need some help, just ask. I’ll do my best to help you out.