Shop OBEX P1 Docs P2 Docs Learn Events
2ndTest — Parallax Forums

2ndTest

StingrayRemoteStingrayRemote Posts: 3
edited 2011-06-29 16:11 in General Discussion
When creating or editing your post, just enclose your code between {code] and [/code} tags.

Trying to post code.
'' File: pushbutton_forward_stingray1.spin
{{

──────────────────────────────────────────────────────────
│ P24 │ P25 │   LEFTMOTOR   │ P26 │ P27 │   RIGHTMOTOR   │
──────────────────────────────────────────────────────────
│  0  │  0  │     BRAKE     │  0  │  0  │      BRAKE     │
│  1  │  0  │    REVERSE    │  1  │  0  │     FORWARD    │
│  0  │  1  │    FORWARD    │  0  │  1  │     REVERSE    │
│  1  │  1  │     BRAKE     │  1  │  1  │      BRAKE     │
──────────────────────────────────────────────────────────

       +5V                   +5V
        Δ                     Δ  LED
        |                     └┐
         PUSHBUTTON             │C
 P0 >───┫            P1 >─────
         2kΩ            10kΩ  B │E
                                
       GND                      GND
}}
CON
_xinfreq        = 5_000_000                             ' External Crystal Frequency
_clkmode        = xtal1 + pll16x                        ' Enabled External Crystal and PLL X16

  pushbutton1   = 0                                     ' pushbutton1 is connected to P0
  
  


PUB Main
dira[1]      := %1                                      ' Led P1 is set to output
dira[27..24] := %1111                                   ' Set P24 Through P27 To output for motors
  repeat                                                ' repeat loop
    if ina[pushbutton1] == 1                            ' If P0 = 1 then turn on led and move motors
        outa[1] := 1                                    ' P1 is High (led turns on)                             
        outa[25] := 1                                   ' Left Motor Forward
        outa[26] := 1                                   ' Right Motor Forward
        waitcnt(clkfreq / 1000 * 500 + cnt)             ' 500 millisecond Pause for on motors
        outa[25] := 0                                   ' Left Motor stop
        outa[26] := 0                                   ' Right Motor stop
    else                                                ' Or else
    outa[1] := 0                                        ' P1 is Low (led turns off) and goto repeat

How to attach a full sized image inline?

1. Put {img][/img} placeholders in your post where you want the images to appear.

2. Upload your images.

3. Preview your post. The image thumbnails will appear at the bottom of the preview.

4. For each image, right click on its thumbnail, and select "Copy link address" -- not "Copy image address."

5. Paste this address between the img tag placeholders from step 1. above.

That's all there is to it!

[img][/img]
Sunset.jpg

634 x 512 - 89K
800 x 600 - 70K

Comments

Sign In or Register to comment.