Shop OBEX P1 Docs P2 Docs Learn Events
Stamp gets stuck — Parallax Forums

Stamp gets stuck

TheRooDawgTheRooDawg Posts: 3
edited 2008-02-08 01:31 in General Discussion
Hello

<code>
' {$STAMP BS2}
' {$PBASIC 2.5}
hours VAR Word
minutes VAR Word
minute VAR Word
cycles VAR Word
cycle VAR Word
counter VAR Word
counter2 VAR Word
hours = 6·········· 'Feed every # hours
minutes = hours*60· 'Hours to minutes
minute = 59700····· 'Error compensated milliseconds per minute
cycles = 2········· 'Number of feeding revolutions
cycle = 1225······· 'On time for one revolution

FREQOUT 0, 200, 3000
PAUSE 5000

DO
'Breakfast
LOW 9
HIGH 6
GOSUB work
'Lunch
LOW 6
HIGH 7
GOSUB work
'Dinner
LOW 7
HIGH 8
GOSUB work
'Midnight
LOW 8
HIGH 9
GOSUB work
LOOP

' ---- Subroutine: Work
work:
· GOSUB feed
· GOSUB time
RETURN

' ---- Subroutine: Time
time:
FOR counter = 1 TO minutes
· PAUSE minute
NEXT
RETURN
' ---- Subroutine: Feed
feed:
FOR counter = 1 TO cycles
· HIGH 1
· PAUSE cycle
· LOW 1
· PAUSE 1500
NEXT
RETURN
</code>

Comments

  • TheRooDawgTheRooDawg Posts: 3
    edited 2008-02-08 01:31
    Hello
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    hours VAR Word
    minutes VAR Word
    minute VAR Word
    cycles VAR Word
    cycle VAR Word
    counter VAR Word
    counter2 VAR Word
    
     
    hours = 6           'Feed every # hours
    minutes = hours*60  'Hours to minutes
    minute = 59700      'Error compensated milliseconds per minute
    cycles = 2          'Number of feeding revolutions
    cycle = 1225        'On time for one revolution
     
    FREQOUT 0, 200, 3000
    PAUSE 5000
     
    DO
    'Breakfast
    LOW 9
    HIGH 6
    GOSUB work
    'Lunch
    LOW 6
    HIGH 7
    GOSUB work
    'Dinner
    LOW 7
    HIGH 8
    GOSUB work
    'Midnight
    LOW 8
    HIGH 9
    GOSUB work
    LOOP
     
    ' ---- Subroutine: Work ----------
    work:
      GOSUB feed
      GOSUB time
    RETURN
     
    ' ---- Subroutine: Time ----------
    time:
    FOR counter = 1 TO minutes
      PAUSE minute
    NEXT
    RETURN
     
    ' ---- Subroutine: Feed ----------
    feed:
    FOR counter = 1 TO cycles
      HIGH 1
      PAUSE cycle
      LOW 1
      PAUSE 1500
    NEXT
    RETURN
    

    Stamp gets stuck smhair.gif
Sign In or Register to comment.