If you want someone to do programming for you then you should ask in the Gigs and Collaborations section and be prepared to pay.
If you want to do it yourself this Simple Merge Demo may give you some ideas. The important thing is to eliminate multiple use of a resource - such as an I/O pin.
It's difficult for me to understand why so much difficulty in merging sketches. I normally test each functionality in different sketches. While coming up with the final sketch I will combine all these pieces together in my final sketch.It's painful but not that difficult either.
sarouje:
It's difficult for me to understand why so much difficulty in merging sketches. I normally test each functionality in different sketches. While coming up with the final sketch I will combine all these pieces together in my final sketch.It's painful but not that difficult either.
For people who have some experience, understand the possible areas of conflict, and have a systematic approach, it is not difficult. That is correct. For others, the guideline mentioned in the posts above can help to get started.
John, why are you being such a douche? Is your code written to make newbies feel like they can never understand Arduino programming? Someone new to the way Arduino works doesn't get most of what you have written. If they learn to read a low-side switch using a resistor, then it's a no-brainer when the learn about INPUT_PULLUP. If you just push it on them, it's merely an incantation.
Perhaps YOU should read and study Robin's merge demo. THAT is how you write a tutorial. Take the time to understand how learning happens, rather than just writing a complex program to fan you ego.
void readSwitches(){ //Evaluates the States of the four Switches
swAval = digitalRead(swA);
swBval = digitalRead(swB);
//delay(300);
}
Four switches?
The purpose of this file is to have many sketches run on one program.
Nonsense
The core menu code would be, I estimate, about an eighth to a quarter the size it is, if function pointers and arrays were employed.
The RAM footprint of this sketch is also excessive.
And there's a subtle bug in "I2Cscan".
Your do this while (swBval == 1){ in each of your menus. It's pointless, you may as well just do while (1){
I can't recommend it as a good example of programming practice.
I also use the INPUT_PULLUP classification so you don't have to use those stupid pull up resistors. (I can't believe Eggspurts are still recommending resistance).
Our dear friend John is indeed an eggspurt.
It seems he doesn't understand that there are conditions (e.g. long wires which result in capacities which grow with the kind of cable and the distance) when internal pullups are no good idea because they will simply fail.
That's the time when external pullups come into play.
Whenever short distances are given, I also prefer to use the internal pullup resistors as they save devices, space and add'tl wiring