Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. #N canvas 741 125 674 720 10;
  2. #X obj 13 -172 cnv 15 600 120 empty empty 1.c.iv.2_RPi_PdWiringPi 20
  3. 12 0 14 -204800 -66577 0;
  4. #X text 76 -145 Demonstrate basic hardware input and output on a Raspberry
  5. Pi using the wiringPi library via pdwiringPi.;
  6. #X obj 28 5 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
  7. -1;
  8. #X text 26 -31 Pin-specific input object. The pin numbering scheme
  9. follows the Broadcom GPIO numbers.;
  10. #X floatatom 34 59 5 0 0 0 - - -, f 5;
  11. #X msg 34 393 pinMode 18 pwm_output;
  12. #X text 24 329 PWM mode only works on specific GPIO pins.;
  13. #X text 161 177 BCM 18 \, physical 12 \, wPi 1;
  14. #X text 42 521 (default PWM period measured at 3.4uSec on RPi B+);
  15. #X text 77 -104 Note that the pdwiringPi/wiringPi object using the
  16. BCM or Broadcom numbering \, not the wPi numbering.;
  17. #X text 51 5 BCM 17 \, physical 11 \, wPi;
  18. #X obj 28 85 print input-17;
  19. #X text 214 256 Generic object accepting general I/O messages.;
  20. #X msg 29 177 pinMode 18 output;
  21. #X msg 49 200 digitalWrite 18 0;
  22. #X msg 77 224 digitalWrite 18 1;
  23. #X text 200 394 BCM 18 \, physical 12 \, wPi 1;
  24. #X msg 53 417 pwmWrite 18 512;
  25. #X msg 67 440 pwmWrite 18 128;
  26. #X msg 77 464 pwmWrite 18 768;
  27. #X text 22 351 Click the messages in sequence to enable PWM mode and
  28. set various brightness levels using a PWM signal.;
  29. #X obj 28 29 pdwiringPi/wiringPi pin 17 input;
  30. #X obj 69 255 pdwiringPi/wiringPi;
  31. #X obj 44 493 pdwiringPi/wiringPi;
  32. #X msg 246 225 digitalRead 18;
  33. #X obj 68 279 print input-18;
  34. #X text 24 133 Click the messages in sequence to configure a digital
  35. output and turn the light from the exercise circuit on and off.;
  36. #X text 357 224 Read back the output.;
  37. #X text 167 641 BCM 18 \, physical 12 \, wPi 1;
  38. #X msg 35 641 pinMode 18 output;
  39. #X obj 73 849 pdwiringPi/wiringPi;
  40. #X msg 82 817 digitalWrite 18 \$1;
  41. #X obj 82 667 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
  42. 1;
  43. #X text 98 667 Enable 'soft' PWM using digitalWrite();
  44. #X text 30 575 Click the output message to reconfigure the output as
  45. a normal digital output \, then enable the metro to turn the light
  46. from the exercise circuit on and off using timing from Pd.;
  47. #X obj 82 791 f 0;
  48. #X obj 112 791 == 0;
  49. #X text 149 791 toggle between 0 and 1;
  50. #X obj 82 764 metro 1;
  51. #X text 35 893 This tries to toggle the output as fast as possible
  52. \; if you observe it on an oscilloscope \, you'll notice it may be
  53. bursty since Pd is competing for CPU time and does not have exclusive
  54. control. Try reducing the metro rate until the waveform is consistent.
  55. ;
  56. #X msg 141 703 1;
  57. #X msg 142 727 10;
  58. #X text 187 704 500 Hz;
  59. #X text 193 726 50 Hz;
  60. #X text 144 765 timing for each half-cycle;
  61. #X connect 2 0 21 0;
  62. #X connect 5 0 23 0;
  63. #X connect 13 0 22 0;
  64. #X connect 14 0 22 0;
  65. #X connect 15 0 22 0;
  66. #X connect 17 0 23 0;
  67. #X connect 18 0 23 0;
  68. #X connect 19 0 23 0;
  69. #X connect 21 0 4 0;
  70. #X connect 21 0 11 0;
  71. #X connect 22 0 25 0;
  72. #X connect 24 0 22 0;
  73. #X connect 29 0 30 0;
  74. #X connect 31 0 30 0;
  75. #X connect 32 0 38 0;
  76. #X connect 35 0 36 0;
  77. #X connect 35 0 31 0;
  78. #X connect 36 0 35 1;
  79. #X connect 38 0 35 0;
  80. #X connect 40 0 38 1;
  81. #X connect 41 0 38 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement