I downloaded a sketch that I absolutely love. With it I can control a relay board from anywhere I go. The problem is that I have a 16 channel relay board and I can only control 10 of them. I'm not very program savvy so I can't take credit for writing the sketch from scratch, rather I downloaded it and changed several things to make it work for me. I've attached the sketch for you to examine, and I sincerely appreciate any help I can get. Thanks all for your help, have a great day.
Why is there a comment that 'outputQuantity' should not exceed 10 ?
It is used for other things and stored in EEPROM.
On the other hand, the 'outputAddress' is already 16.
I don't know what will happen if that number is made 16.
Actually, I did set it to 16 and I did get 16 outputs. But when I try to make them HIGH or LOW nothing happens. It seems that I can go as high as I want and they will be displayed on the web interface but clicking ON or OFF only works for the first 10 outputs. I need to be able to make all 16 turn ON or OFF. Sorry, maybe my initial question wasn't clear enough now that I look at it. But thanks to you for your help.
Maybe this (and similar lines) is the problem
case '10':
You CANNOT have more than one character between single quotes - so I suspect the input values from 0 to 9 work fine and the bigger values don't
You will need to modify the code that reads the client so it behaves like the 2nd or 3rd example in serial input basics - the existing code can only read a single character and rather than fix that I think the author just put a limit of 10 items. More likely he was out of his depth.
And you will need to convert the received values (e.g. "10") into numbers so that they can work with CASE. The parse example shows how to do that.
Thanks Robin, I feel like I'm getting closer after reading that, but I was wondering if you could be so kind as to point out the problem lines so I can make an attempt at changing them? I am definitely out of my league for this sort of project. It seems like there's so much to learn and so little time to learn it, lol. Thanks again.
The offending case '10': is on line 269 - however the problem is such that a lot of the code will need to be changed. There needs to be a change of concept - not just correcting a few lines.
I suggest you start by studying the differences in the approach to reading data in your code and in the examples in serial input basics.
Once you understand what the problem is the changes should not be difficult.
You should probably also study SWITCH/CASE and IF in the Reference section.
That whole switch statement is cargo-cult coding I think, it just needs a lookup. Use
'A', 'B' etc to extend the relay numbering, convert the character to an array offset then
index outputAddress[] directly.