Advertisement
dyeske

mario

Jun 18th, 2024
522
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.63 KB | None | 0 0
  1. #!/usr/bin/env python
  2. """ This is library of stuff """
  3.  
  4. from datetime import datetime, date, time
  5. import subprocess
  6. import os
  7. import time
  8.  
  9. usleep = lambda x: time.sleep(x / 1000000.0)
  10. msleep = lambda x: time.sleep(x / 1000.0)
  11.  
  12. def system_wrap(cmd):
  13.     """ system wrapper """
  14.     return subprocess.check_call(cmd, shell=True)
  15.  
  16. def tone(pwm, freq, t_note, t_silent):
  17.     """ play a tone """
  18.     note = round(t_note / 5.0)    
  19.     myfreq = round(freq / 1.0)    
  20.     sleep = round(t_silent / 5.0)    
  21.     cmd = "/usr/local/bin/beep -p " + str(myfreq) + " " + str(note)
  22.     system_wrap(cmd)
  23.     msleep(sleep)
  24.     print(cmd + " " + str(sleep))
  25.  
  26. def mario(pin):
  27.     """ play mario """
  28.     pwm = "wtf"
  29.     tone(pwm, 660, 100, 75)
  30.     tone(pwm, 660, 100, 150)
  31.     tone(pwm, 660, 100, 150)
  32.     tone(pwm, 510, 100, 50)
  33.     tone(pwm, 660, 100, 150)
  34.     tone(pwm, 770, 100, 275)
  35.     tone(pwm, 380, 100, 287)
  36.     tone(pwm, 510, 100, 225)
  37.     tone(pwm, 380, 100, 200)
  38.     tone(pwm, 320, 100, 250)
  39.     tone(pwm, 440, 100, 150)
  40.     tone(pwm, 480, 80, 165)
  41.     tone(pwm, 450, 100, 75)
  42.     tone(pwm, 430, 100, 150)
  43.     tone(pwm, 380, 100, 100)
  44.     tone(pwm, 660, 80, 100)
  45.     tone(pwm, 760, 50, 75)
  46.     tone(pwm, 860, 100, 150)
  47.     tone(pwm, 700, 80, 75)
  48.     tone(pwm, 760, 50, 175)
  49.     tone(pwm, 660, 80, 150)
  50.     tone(pwm, 520, 80, 75)
  51.     tone(pwm, 580, 80, 75)
  52.     tone(pwm, 480, 80, 175)
  53.     tone(pwm, 510, 100, 275)
  54.     tone(pwm, 380, 100, 200)
  55.     tone(pwm, 320, 100, 250)
  56.     tone(pwm, 440, 100, 150)
  57.     tone(pwm, 480, 80, 165)
  58.     tone(pwm, 450, 100, 75)
  59.     tone(pwm, 430, 100, 150)
  60.     tone(pwm, 380, 100, 100)
  61.     tone(pwm, 660, 80, 100)
  62.     tone(pwm, 760, 50, 75)
  63.     tone(pwm, 860, 100, 150)
  64.     tone(pwm, 700, 80, 75)
  65.     tone(pwm, 760, 50, 175)
  66.     tone(pwm, 660, 80, 150)
  67.     tone(pwm, 520, 80, 75)
  68.     tone(pwm, 580, 80, 75)
  69.     tone(pwm, 480, 80, 250)
  70.     tone(pwm, 500, 100, 150)
  71.     tone(pwm, 760, 100, 50)
  72.     tone(pwm, 720, 100, 75)
  73.     tone(pwm, 680, 100, 75)
  74.     tone(pwm, 620, 150, 150)
  75.     tone(pwm, 650, 150, 150)
  76.     tone(pwm, 380, 100, 75)
  77.     tone(pwm, 430, 100, 75)
  78.     tone(pwm, 500, 100, 150)
  79.     tone(pwm, 430, 100, 75)
  80.     tone(pwm, 500, 100, 50)
  81.     tone(pwm, 570, 100, 110)
  82.     tone(pwm, 500, 100, 150)
  83.     tone(pwm, 760, 100, 50)
  84.     tone(pwm, 720, 100, 75)
  85.     tone(pwm, 680, 100, 75)
  86.     tone(pwm, 620, 150, 150)
  87.     tone(pwm, 650, 200, 150)
  88.     tone(pwm, 1020, 80, 150)
  89.     tone(pwm, 1020, 80, 75)
  90.     tone(pwm, 1020, 80, 150)
  91.     tone(pwm, 380, 100, 150)
  92.     tone(pwm, 500, 100, 150)
  93.     tone(pwm, 760, 100, 50)
  94.     tone(pwm, 720, 100, 75)
  95.     tone(pwm, 680, 100, 75)
  96.     tone(pwm, 620, 150, 150)
  97.     tone(pwm, 650, 150, 150)
  98.     tone(pwm, 380, 100, 75)
  99.     tone(pwm, 430, 100, 75)
  100.     tone(pwm, 500, 100, 150)
  101.     tone(pwm, 430, 100, 75)
  102.     tone(pwm, 500, 100, 50)
  103.     tone(pwm, 570, 100, 110)
  104.     tone(pwm, 500, 100, 150)
  105.     tone(pwm, 760, 100, 50)
  106.     tone(pwm, 720, 100, 75)
  107.     tone(pwm, 680, 100, 75)
  108.     tone(pwm, 620, 150, 150)
  109.     tone(pwm, 650, 200, 150)
  110.     tone(pwm, 1020, 80, 150)
  111.     tone(pwm, 1020, 80, 75)
  112.     tone(pwm, 1020, 80, 150)
  113.     tone(pwm, 380, 100, 150)
  114.     tone(pwm, 500, 100, 150)
  115.     tone(pwm, 760, 100, 50)
  116.     tone(pwm, 720, 100, 75)
  117.     tone(pwm, 680, 100, 75)
  118.     tone(pwm, 620, 150, 150)
  119.     tone(pwm, 650, 150, 150)
  120.     tone(pwm, 380, 100, 75)
  121.     tone(pwm, 430, 100, 75)
  122.     tone(pwm, 500, 100, 150)
  123.     tone(pwm, 430, 100, 75)
  124.     tone(pwm, 500, 100, 50)
  125.     tone(pwm, 570, 100, 210)
  126.     tone(pwm, 585, 100, 275)
  127.     tone(pwm, 550, 100, 210)
  128.     tone(pwm, 500, 100, 180)
  129.     tone(pwm, 380, 100, 150)
  130.     tone(pwm, 500, 100, 150)
  131.     tone(pwm, 500, 100, 75)
  132.     tone(pwm, 500, 100, 150)
  133.     tone(pwm, 500, 60, 75)
  134.     tone(pwm, 500, 80, 150)
  135.     tone(pwm, 500, 60, 175)
  136.     tone(pwm, 500, 80, 75)
  137.     tone(pwm, 580, 80, 175)
  138.     tone(pwm, 660, 80, 75)
  139.     tone(pwm, 500, 80, 150)
  140.     tone(pwm, 430, 80, 75)
  141.     tone(pwm, 380, 80, 300)
  142.     tone(pwm, 500, 60, 75)
  143.     tone(pwm, 500, 80, 150)
  144.     tone(pwm, 500, 60, 175)
  145.     tone(pwm, 500, 80, 75)
  146.     tone(pwm, 580, 80, 75)
  147.     tone(pwm, 660, 80, 225)
  148.     tone(pwm, 870, 80, 162)
  149.     tone(pwm, 760, 80, 300)
  150.     tone(pwm, 500, 60, 75)
  151.     tone(pwm, 500, 80, 150)
  152.     tone(pwm, 500, 60, 175)
  153.     tone(pwm, 500, 80, 75)
  154.     tone(pwm, 580, 80, 175)
  155.     tone(pwm, 660, 80, 75)
  156.     tone(pwm, 500, 80, 150)
  157.     tone(pwm, 430, 80, 75)
  158.     tone(pwm, 380, 80, 300)
  159.     tone(pwm, 660, 100, 75)
  160.     tone(pwm, 660, 100, 150)
  161.     tone(pwm, 660, 100, 150)
  162.     tone(pwm, 510, 100, 50)
  163.     tone(pwm, 660, 100, 150)
  164.     tone(pwm, 770, 100, 225)
  165.     tone(pwm, 380, 100, 0)
  166.  
  167. mario(1)
  168.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement