here is the code
void dmx(int zo, int col, int dim) //If "zo" is 1, and "col" is 2
{
DmxSimple.write(zocol, dim); // I need zocal to be "12"
Serial.println(newDmx);
}
arduino uno 1.5.2
Thanks for the help!
here is the code
void dmx(int zo, int col, int dim) //If "zo" is 1, and "col" is 2
{
DmxSimple.write(zocol, dim); // I need zocal to be "12"
Serial.println(newDmx);
}
arduino uno 1.5.2
Thanks for the help!
zocol = col * 10 + dim;
-br
zo and col are always changing to a new dmx channel! I need to combine zo and col to a new variable?
I tried String.replace
void dmx(int zo, int col, int dim)
{
String newDmx;
newDmx = "01";
newDmx.replace ('0', zo);
newDmx.replace ('1', col);
DmxSimple.write(newDmx, dim);
Serial.println(newDmx);
}
I get this error
DMX_TouchScreenLighting.ino: In function 'void dmx(int, int, int)':
DMX_TouchScreenLighting:52: error: no matching function for call to 'DmxSimpleClass::write(String&, int&)'
I then tried newDmx += zo += col;
But it just adds the two together I need it to join or combine the two?
The routine doesn't like the String argument.
Are you trying to write a string, (or a String?) or a binary integer?
-br
So I need to convert the integers "zo" and "col" to strings than use replace
newDmx.replace ('0', zo);
newDmx.replace ('1', col);
Then I need to convert the string back to a integer before I use it in
DmxSimple.write(newDmx, dim);
How would I do that? Thanks
Well, you can do it the roundabout way you suggest, especially if you are being paid by the line.
Or you can use the code I posted up above in Reply #1, which does the same thing without the intermediate conversion to string format. Take a minute to understand what it's doing.
-br
Billroy,
Thanks I have no idea what I was thinking. lol
void dmx(int zo, int col, int dim)
{
int zocol;
zocol = zo * 10 + col;
DmxSimple.write(zocol, dim);
Serial.println(newDmx);
}
This works great! Thanks
Wouldn't it be more like this, "zocol = zo * 10 + col;" ?
zocol must be declaired as a new variable, not just combining zo and col.
Edit, never mind.
Glad it works. Good luck with the rest of your project.
-br