Shop OBEX P1 Docs P2 Docs Learn Events
Serial input to control led — Parallax Forums

Serial input to control led

MrCatNestaMrCatNesta Posts: 2
edited 2008-08-08 22:45 in BASIC Stamp
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

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-08 22:23
    Have you tried to control the LEDs, like make them blink?

    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".
  • MrCatNestaMrCatNesta Posts: 2
    edited 2008-08-08 22:45
    Thanks for the help.
    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
Sign In or Register to comment.