Serial input to control led
MrCatNesta
Posts: 2
Does anyone have an example code for this?
I have two LEDs and I want to receive a serial string to control on, off or both on?
I have an extra cpu with a terminal app to send the string.
any advise will be appreciated.
Thanks,
Mr Cat Nesta
I have two LEDs and I want to receive a serial string to control on, off or both on?
I have an extra cpu with a terminal app to send the string.
any advise will be appreciated.
Thanks,
Mr Cat Nesta
Comments
Have you read the section of the manual on the SERIN and SEROUT statements and on the DEBUG and DEBUGIN statements?
Try writing a short program that uses the DEBUG and DEBUGIN statements to read characters from your PC, compares the incoming characters to "0" and "1" and turns on one of the LEDs if there's a "1" or turns it off if there's a "0". Once you have that working, then expand it to work with two LEDs and "0", "1", "2", and "3".
However I do have another question.
What if I was adjusting the duty of a pwm?
I would receive a byte (0-255) on the serin...
Would I need to setup 265 compare statements?
Thanks,
Mr. Cat Nesta