Alright i'm using an el cheapo radio module to send a serial message. The signal gets inverted though... how would i invert the incoming serial using software? can't the arduino accept an inverted signal on the rx?
int incoming = Serial.read();
if (incoming >= 0)
{[glow]
byte inverted = 255 - incoming;
byte inverted = ~incoming;
byte inverted = incoming ^ 0xFF;
[/glow] // do something with inverted
}
Take your pick of any one of the three highlighted lines.
You can't - the hardware UART expects certain signal levels.
You may be able to use software serial and hack the code to invert the sense of the received signal.
If the signal is "inverted" I can't help but wonder if it's at RS232 levels and you need to convert it to TTL?
-j
Indeed, the UART will expect the start and stop bits to be at certain levels, and will not accept them if they're inverted. You can invert a digital signal with a TTL inverter, such as the 74LS04.
yeah thanks. I just need to buy an xbee or look into the serial IR systems in one of my books...
Sgnal need to be HIGH when idle.