Advertisement
Guest User

Untitled

a guest
Jan 12th, 2019
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. symbol rampup=b0
  2. symbol rampdwn=b1
  3. let b8 = 10
  4.  
  5. do 
  6.     standby: 'Procedure name e.g. goto Standby
  7.  
  8.  
  9.     low 0  
  10.     low 1
  11.     low 2
  12.     low 4  
  13. '    Turns All Led's OFF
  14.  
  15.        
  16.     pause 20
  17.            
  18.     'ORDER OF FADE               
  19.     b5=4
  20.     gosub Fade 'First return comes here      
  21.     b5=2      
  22.     gosub Fade  'Second return comes here          
  23.     b5=1  
  24.     gosub Fade  'Third return comes here              
  25.     b5=0    
  26.     gosub Fade  'Fourth return comes here                                                                            
  27.     goto Fade  'Go back to the start of the fade loop
  28.     loop while b2 < 15 'Random variable that should always be 0 to keep the loop running
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. Fade:
  37. pause 20
  38. ' UPWARD FADE SECTION
  39. for rampup=1 to 255 step 1 ' To speed up the change/fade set the step step value between 1 and 15  
  40. pwm b5,rampup,1          
  41. pause 4 ' To slowdown the change/fade, insert pause 1 to 10 here
  42. if pinC.3 = 1 then goto Start 'Checks if the button is pressed, if so then return to the start of the program (Not needed if you only want led's to to fade endlessly)
  43. next rampup
  44.  
  45. ' DOWNWARD FADE SECTION
  46. for rampdwn=225 to 1 step -1  
  47. pwm b5,rampdwn,1
  48. pause 3
  49. if pinC.3 = 1 then goto Start 'Checks if the button is pressed, if so then return to the start of the program (Not needed if you only want led's to to fade endlessly)
  50. next rampdwn
  51. low 0
  52. pause 300                      
  53. return 'Returns back to the next led in the chain
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement