This look good? I didn't even know about the internal pull-up on the arduino. I love this community.
That looks good to me.
Again, reading the TRANSISTOR output doesn't make any sense, and since you know the status of SENSOR (which you store in the variable "val"), you don't have to read anything for the TRANSISTOR.
So, get rid of the line "val2 = digitalRead(TRANSISTOR);" at the top of loop(), and replace the line "if (val2 == HIGH) {" (near the bottom of loop()" with "if (val == HIGH) {".
Also - for my own edification, and because I am not an expert on all things Arduino (I just pretend I am ;)) - isn't HIGH defined as 1 (in the headers), whereas LOW is defined as 0, and is therefore more or less equivalent to true/false?
That is, rather than writing "if (signal == HIGH) {" or "if (signal == LOW) {", you could simply write "if (signal) {" or "if (!signal) {" (respectively), and get the same results?
Also - does the compiler generate the same amount of code either way, or does one or the other method yield shorter code (provided they are equivalent, of course)?