That seems about right. Except make sure those lines like pwm01-255; is actually pwm01=255;, otherwise that should be a syntax error. I don’t know why the compiler isn’t detecting that one.
First, the IR sensor board signals are read as 0 (false) when not active, and as 1 (true) when detecting a signal. That’s the opposite of how a switch to ground is typically sensed, so you need to remove the exclamation point.
Second, because of this behavior, a disconnected board will read as if all four signals are active simultaneously. It would be a good idea to put in a check to make sure only one signal is being detected, and ignore everything if multiple signals show up at the same time.
Third, I think you meant to use an equals sign instead of a minus sign. As you have written it, the compiler will accept such lines without complaint, but the code won’t actually do anything.
Fourth, you don’t have any open braces after your if statements. The compiler will not be happy about that, and will complain about what it thinks is an “extra” closing brace when it encounters one.
Finally, the maximum output for a pwm signal is actually 254, not 255. (I don’t know where in the system it gets limited, but I know the dashboard will show 254 if you do attempt to set a pwm output to 255.)