in another post i was asked to post a new thread on merging sketches i have tried for a week now and have got no further ,the first sketch turns water on twice a day
the secound one connects alexa
both these codes work on their own but can not get them to merge ,the third code is what i have done ,im sure its the right one as ide crashed and had to re intall and avr errors all over ,have sorted that now
any pointers /ideas please
originaltrial.ino (8.93 KB)
Code_Alexa_Control_Relay_Local_WiFiwrks1.ino (7.67 KB)
merged1.ino (11.2 KB)
By now, you should realize that this isn't enough information for us to use. You're not telling us anything about what is wrong, except for the vague, "can not get them to merge".
This Simple Merge Demo may give you some ideas.
Before trying to merge the programs go through each of them carefully to make sure they are not trying to use the same resource - for example an I/O pin. If you find conflicts change something in one of the separate programs and make sure it still works as a separate program with the change.
well a first look i noticed you have twice void setup and void loop in your merged file
i was rushing seems to stop at espalexa.loop();expected initialiser error
will have aother go at it tomorrow and post correct one with better description thanks
What is the merged version supposed to do? I assume that the auto watering should still take place but the Serial commands go away to be replaced by Alexa. Is that it?
In the merged sketch, you have the setup code for the watering part inside an if statement.
Would help if you would remove the sequences of multiple blank lines in the code, makes it harder to read.
After you get the sketch working, you should consider removing the hardware RTC, with wifi access you can use a software RTC synced to an NTP server.
updated sketch now compiles but alexa will not now connect to wifi
Code_Alexa_Control_Relay_Local_WiFiwrksand_waterfinalwrk1s.ino (13.2 KB)
Big bang testing is tricky. You can try & debug it of course. Maybe you have a pin or library conflict. Alternatively, you could go back to the working Alexa sketch and start adding the smallest piece you can from the watering sketch and get it to compile and then test it to make sure Alexa is still happy.
Add your watering code little by little. Keep testing. Along the way, perhaps you'll find out more easily why the whole thing you have now stopped working.
That's how I got it this far add little and test I'll give it another go from scratch ,did reply yesterday but some reason it never posted
If you have tried different things for a whole week and it did not work I guess this indicates you know too less about programming. Too less about basic programming things.
I estimate that investing 4 hours of time into learning the basics would have saved you 16 hours of testing around with not really knowing what you do.
I recommend reading this tutorial
Of course you can ask here in the forum. But then you have to wait for the answers. If you start to learn how coding works you become more and more independent of waiting for answers.
Take a look into this tutorial:
Arduino Programming Course
It is easy to understand and has a good mixture between explaining important concepts and example-codes to get you going. So give it a try and report your opinion about this tutorial.
I'm a somehow advanced programmer and this has the effect of beeing partially blind about beginners difficulties. But I would like to become an "expert" about beginners difficulties and therefore I appreciate feedback about that and to receive questions what is still hard to understand. Inside this tutorial. It is not written by me but I'm interested anyway.
best regards Stefan