Shop OBEX P1 Docs P2 Docs Learn Events
I only want to toggle an LED! — Parallax Forums

I only want to toggle an LED!

kutalinelucaskutalinelucas Posts: 80
edited 2011-08-14 07:57 in Propeller 1
This is my first day into the prop chip and I'm already a little coffuffled...

Does anybody know why this statement works...
if(reconstructed_data := 27)
  !OUTA[8]
  reconstructed_data := 0
  RETURN

but not this...
if(reconstructed_data < 30)
  !OUTA[8]
  reconstructed_data := 0
  RETURN

I can choose any arbitary number and send it over 2 nibbles to the prop, but for some reason the less-than 30 statement won't toggle an LED! quite fustrated falling over at such an early stage and I'd really appriciate a suggestion...can post my code so far if it'll help. cheers

Comments

  • Heater.Heater. Posts: 21,230
    edited 2011-08-14 06:48
    In your first code snippet you are using := which is an assignment. reconstructeddata gets set to 27 and then the if is allway TRUE because 27 is not zero, so the outa always happens. Do you mean to use == here?
    In your second snippet you are doing a comparison which I guess is never TRUE.
  • kutalinelucaskutalinelucas Posts: 80
    edited 2011-08-14 07:57
    Thanks for getting back to me...It was a silly mistake in my C++ application, and you are right, I thought the data bus was fine because I was assigning a value to a conditional statement.

    Thanks for the help
Sign In or Register to comment.