Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #rem
- 4th Form Display Project 2010
- Theme: NASA
- Programmer: Manav *****
- Other team members: ****** ** (Electronics), ******* ********** (Design), *** ********* (Design)
- ============================================================================
- USER PIN CONNECTIONS
- ============================================================================
- PIN 0 (output) LEDs
- PIN 1 (output) LEDs
- PIN 2 (output) LEDs
- PIN 3 (input) Push Switch
- PIN 4 (output) Motor
- ============================================================================
- ALGORITHM
- ============================================================================
- Switch on
- Press button
- Play light sequence
- Run motor for 6 seconds
- Play light sequence
- End
- #endrem
- '============================================================================
- 'SET UP INPUTS AND OUTPUTS
- '============================================================================
- init:
- let dirs = %00010111 'sets pins 0,1,2,4 as oututs & pin 3 as an input
- '============================================================================
- 'MAIN PROGRAM ROUTINE
- '============================================================================
- attractLEDs:
- high 0,1,2
- pause 150
- low 0,1,2
- if pin3 = 1 then goto start
- pause 150
- goto attractLEDs
- start:
- if pin3 = 1 then goto main
- goto start
- main:
- if pin3 = 1 then goto LEDs
- goto start
- '============================================================================
- 'SUBROUTINES
- '============================================================================
- LEDs:
- pause 1000
- for b1 = 1 to 3
- high 0
- pause 100
- low 0
- high 1
- pause 100
- low 1
- high 2
- pause 100
- low 2
- next b1
- pause 1000
- goto LEDs2
- LEDs2:
- for b3 = 1 to 3
- high 0,1,2
- pause 200
- low 0,1,2
- pause 200
- next b3
- pause 1000
- goto motor
- motor:
- let b0 = 60
- high 0,1,2
- pwm 4, 100, 2
- pwm 4, b0, 1000
- pwm 4, b0, 1000
- pwm 4, b0, 1000
- pwm 4, b0, 1000
- pwm 4, b0, 1000
- pwm 4, b0, 1000
- low 0,1,2
- goto LEDs3
- LEDs3:
- for b5 = 1 to 3
- high 0
- pause 300
- low 0
- high 1
- pause 300
- low 1
- high 2
- pause 300
- low 2
- next b5
- pause 1000
- goto LEDs4
- LEDs4:
- for b7 = 1 to 5
- high 0,1,2
- pause 100
- low 0,1,2
- pause 100
- next b7
- pause 2000
- goto attractLEDs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement