Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. {
  2. WebRinger -- Rings a bell when it receives a signal
  3. on an input pin (ideally, sent by a standalone, web
  4. enabled host like a Raspberry Pi)
  5.  
  6. Dependencies..: Servo32v7
  7. Author........: Michael Shimniok www.bot-thoughts.com
  8. }
  9. _clkmode = xtal1 + pll16x
  10. _xinfreq = 5_000_000 '80 MHz
  11.  
  12. ms = 80000
  13. delay = 100
  14.  
  15. bell = 9
  16. bellMiddle = 1100
  17. bellRight = 950
  18.  
  19. VAR
  20. long stack1[6]
  21. long count
  22.  
  23. OBJ
  24. servo : "Servo32v7" ' Servo controller
  25. pc : "Simple_Serial"
  26.  
  27. PUB Start | pos, c
  28.  
  29. pc.init(31,30,9600)
  30.  
  31. servo.start
  32. servo.ramp
  33.  
  34. cognew(PinCount, @stack1)
  35.  
  36. repeat
  37. if (count > 0)
  38. ring
  39. count := count - 1
  40. waitcnt(cnt+500*ms)
  41.  
  42. PUB PinCount
  43.  
  44. repeat
  45. waitpeq(|<20, |<20, 0) ' wait for pin 20 to go high
  46. count := count + 1
  47. waitpeq(0, |<20, 0) ' wait for pin 20 to go low again
  48.  
  49.  
  50. PUB ring
  51. repeat 4
  52. servo.set(bell, bellRight)
  53. waitcnt(cnt + delay*ms)
  54. servo.set(bell, bellMiddle)
  55. waitcnt(cnt + delay*ms)