Shop OBEX P1 Docs P2 Docs Learn Events
Practical SXB Book Code Problems — Parallax Forums

Practical SXB Book Code Problems

DigitalDjDigitalDj Posts: 207
edited 2008-02-17 01:41 in General Discussion
I have been playing around trying to learn more of the code for the SX and have run across a snag in the Practical SX Book. I have typed this code in but I get nothing. I tried searching the forum because I had read at one time there was some typos in Jon's book. So I wanted to see if I was doing something wrong or there was an error.

' -------------------------------------------------------------------------
' Program Description
' -------------------------------------------------------------------------
 
Led Blinky 3

' -------------------------------------------------------------------------
' Device Settings
' -------------------------------------------------------------------------
 
DEVICE          SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ            4_000_000

' -------------------------------------------------------------------------
' IO Pins
' -------------------------------------------------------------------------

Led  Pin RB.0
 
' -------------------------------------------------------------------------
' Constants
' -------------------------------------------------------------------------

IsOn  Con  1
IsOff  Con 0
 
' -------------------------------------------------------------------------

' Variables
' -------------------------------------------------------------------------

' =========================================================================
  PROGRAM Start
' =========================================================================
 
Start:
Do
  Led = IsOn
  Pause 500
  Led = IsOff
  Pause 500
Loop

Thanks,
Kevin

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Comments

  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2008-02-17 01:04
    Hello,

    One thing that I don't see in your code is where you define the pin as an output. If it
    isn't defined as one you won't see any change in the LED.

    Robert
  • JonnyMacJonnyMac Posts: 9,217
    edited 2008-02-17 01:29
    Indeed you have a typo, Kevin; I just checked a hard-copy and you omitted the OUTPUT specification for the LED pin.
  • DigitalDjDigitalDj Posts: 207
    edited 2008-02-17 01:41
    AH HA! I didn't catch that! That was a simple mistake on my part. I do really like your book and can't wait until it is done. Very well written and easy for the newbie if he makes sure to read everything smilewinkgrin.gif so output changes it so that what is in the constant specifies output.

    Thanks Guys,

    Kevin




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Sign In or Register to comment.