(originally posted in non-public section)
Is there a logical NOT operator in robotC? I looked around and I can’t see one referenced (web searches… I don’t have robotC with me at work right now). My team wants to make an indicator light on their robot follow the state of a switch, and since the lights are on when the output is off, having a not operator would make this simple.
I was hoping for a “teaching moment” in programming about logic, boolean values, etc with this.
Wanting to do something like…
sensorvalue(LEDoutput) = !sensorvalue(switchinput)
I realize this isn’t correct, but that was what I was thinking of… 
Try:
if(sensorValue(swichinput) != 1){
sensorValue(LEDoutput) == 1;
}
The code you provided (
SensorValue[LEDOutput] = !SensorValue[switchInput]
) should work. The operator ! acts as a logical not in C, and for the most part, RobotC mimics C in terms of operators.
or you could say
if(sensorValue(switchinput) == 0){
//code here
}
because the switches only have two values.
I’ll give it a try when I get back home. The girls this year are new to coding something like this, and the last time I wrote something in C was in 91, so I’m kinda rusty myself. I’ve been posing the things they want to do more as exercises with a starting framework, but not actual code, so they have to get the code right, the configuration right and integrate it into their program. I’ll figure it out myself ahead of time so I can help them through troubleshooting and questions. They are getting better, but logical operators are not something they’ve really done before.