I am sharing code that I have modified, working but stuck from time to time , if any one can find the problem....
Any way attached
Thanks,
Roee
arduino_secrets.h (48 Bytes)
Roee_web_buttons_ok_review.ino (10.5 KB)
I am sharing code that I have modified, working but stuck from time to time , if any one can find the problem....
Any way attached
Thanks,
Roee
arduino_secrets.h (48 Bytes)
Roee_web_buttons_ok_review.ino (10.5 KB)
Hi,
Posting a code from library that I have updated to enable all Digital - outputs
It is working but stuck from time to time, does any one have any idea why ?
This is for nano 33 board, please compile and see the probem
Thanks,
Roee
just enter SSID and Password, open Terminal to see what IP address to connect to (same wifi)
Code: is attached
Roee_web_buttons_ok_review.ino (10.5 KB)
Duplicate topics merged
Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.
Repeated cross-posting will result in a suspension from the forum.
In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.
Thanks in advance for your cooperation.
Ha I was looking for my post and did not find it..... this is why I have repost. Just after posting the second I found it.... strange
In your PM to me you asked about moving this thread to another section of the forum. There are specific forum sections for the Nano 33 boards (you have not said which board you are using) but in my experience they don't get much traffic hence may not get many views.
Please use "Report to moderator" if you would like the thread moved, but indicate exactly where you would like it moved to.
Ha I was looking for my post and did not find it.....
I know the problem, i bookmark the ones i start, but it would be so nice to have a button that shows 'threads i started' & 'thread i posted in' rather than just 'updated posts' (i sometimes read something and only realize an answer later, by which time the post may not have had any other answers and is therefore hard to find)
Agree,
This is exactly the button I was looking for ... did not understand how something so basic in forum is not there ...
Your issue is that your code configures WiFi and expects it to work forever. This is good enough for a simple demo but needs to be restructured for a real life application.
You need to check whether your WiFi is working correctly and restart it when necessary. I found it best to create a state machine function (using switch case) that does one little step at a time and is called every time my sketch runs trough loop.
Be sure to remove all the while and delay stuff and replace it with some timers and counters. You want the WiFi task to run as short as possible, doing one little thing at a time and then return. This way the rest of your code stays responsive even when you add functionality.
If you like some code for inspiration please let me know. I can clean up some example code and post it.
Sure :o I will be glad to learn how to do this,
Please clean and do what needed - I am curious to see how to make this better
Thanks!!!!
Roee
roeebloch:
Sure :o I will be glad to learn how to do this,
Please clean and do what needed - I am curious to see how to make this better
Please find attached the demo. It works as follows
I included your web page code and added some code to decode your commands and switch the buttons. This part of the code could probably be done better when the commands are changed. These functions are just quick and dirty to make your page work.
You do not need the command to be one letter, you could have something more complex. e.g. R1ON This could be decoded just as easy because you could use the indexOf() function to search for this in the http GET request.
The loopAnalysis function is just there to see whether the loop runs nicely. You can remove it when you do not need it. A few operations will need some more time like loading the page
Let me known when anything is unclear.
Roee_web_buttons_example.ino (10 KB)
WOW nice work!
This is working perfectly .....
Yes I have added the relay part this is easy to do,
However this is more complicated than I thought, but working perfectly (the example with state machine)
One question: Is there a method to make IP address fixed number?, I have tried but it did not work for me.
Of course to make this work outside home need Dynamic DNS setup so the network can be controlled from outside
Thanks for the code! - I will share it for others in my site later at
http://www.electronicsfreak.net/
BR,
Roee
You can set a fixed IP address by adding e.g.
IPAddress ip(192, 168, 1, 100); at the beginning of the wifiTask
WiFi.config(ip); inside the WIFI_CONNECT before wifiStatus = WiFi.begin( ssid, pass );
Make sure the IP address is allowed by your router as fixed IP address. My router has a range of IP addresses that can be set by the devices themselves.
Note: If you select an IP address that is not available in your home network set by your router, the Arduino will connect to the WiFi network and show you the manually selected IP address. But the connection will not work.
Check your other devices IP address and the subnet mask. e.g.
192.168.1.126 - Laptop
255.255.255.0 - Subnet mask in router settings
All your devices will have an IP address looking like this
192.168.1.XXX - XXX = 2 - 255 (1 is usually the router)