Okay so letโs put a variables block into practice. So what weโre going to do is take these ones and zeroes that refer to the CAN channel and create variables for them. So we can call them CAN channel 1 and CAN channel 2 without confusing the array number with them. So Iโm going to start by creating a constant integer (const int ch1) and call it channel 1. So what this is saying is that weโre going to set this integer on startup and thatโs it, we canโt change it anymore. It stays throughout runtime to this value that we set it at. The reason why weโre doing that is weโre going to put that in here on the, on CanMessage hook. On CanMessage hook requires a constant in for channel, so you canโt go changing it during runtime and confusing those hooks. So we do the same thing with channel 2. What weโll go and weโll do now is weโll go through and change all the values to our new integers.
Now you can see that we replaced all these values with our variables, so what we can do is if, letโs say weโre going to use a five channel device, maybe we want to use channel 2 and 3 instead so what we can do is we can come up here and change the variables, recompile and it allows us to reuse the same code a lot easier than going through and finding and replacing all the values. So thatโs how we can utilize the variables and our t scripts to make things a little bit easier to read and reusable