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