Hi .. Not entirely new to C coding ... I generally follow the manuals, as the only need for coding is to work with PLC's, HMI's, and Automation drivers for linear motors. These systems are well designed for the "coding impaired" ... Kinda like you don't really need to know how a computer works, in order to use one. But every so often some bit of "C" statements are required for things to go well in an Automation design. But, I'm not a designer, just a hobbyist that loves these toys ... I use a linear motor to make waves in a long glass tank of water in order to demonstrate the nature of ocean waves and their reactions to different shore models... also their effect on different floating model structures.
To the point: sometimes I want to make a random selection of specifically designed waves.. just to show a confused storm sea.. easy when using a random generation of the variable x which assigns the "Case" number in a "Switch" routine ... That works just fine ... no help is required there.
But then... I'm thinking I would like not to randomly select the case numbers .. I might want to use the cases in a specific order like 9,9,6,8,1 then start over or.. stop. It's been a while .. can you suggest a way to generate that number sequence in "C" for each time the Switch sequence is run?
Perhaps a variable "t" is incremented by 1 with each Switch cycle, then an if statement assigns the value of "6" if t equals 3 ?
You can see why I can't use BBcode yet Regards, Michael Lambert
To the point: sometimes I want to make a random selection of specifically designed waves.. just to show a confused storm sea.. easy when using a random generation of the variable x which assigns the "Case" number in a "Switch" routine ... That works just fine ... no help is required there.
But then... I'm thinking I would like not to randomly select the case numbers .. I might want to use the cases in a specific order like 9,9,6,8,1 then start over or.. stop. It's been a while .. can you suggest a way to generate that number sequence in "C" for each time the Switch sequence is run?
Perhaps a variable "t" is incremented by 1 with each Switch cycle, then an if statement assigns the value of "6" if t equals 3 ?
You can see why I can't use BBcode yet Regards, Michael Lambert