From 095aab26fbe3cf503b260f734dc738644fdc0302 Mon Sep 17 00:00:00 2001 From: El Jeffo Date: Tue, 29 Sep 2015 10:04:00 +0000 Subject: [PATCH] Example CLI script to play tones --- build | 2 +- examples/cli_song.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) mode change 100644 => 100755 build create mode 100755 examples/cli_song.sh diff --git a/build b/build old mode 100644 new mode 100755 index 7a2126e..88662fc --- a/build +++ b/build @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # check if sudo is required and save the result as ${PFX}: [[ ${EUID} -ne 0 ]] && PFX='sudo ' || PFX='' diff --git a/examples/cli_song.sh b/examples/cli_song.sh new file mode 100755 index 0000000..4e682a5 --- /dev/null +++ b/examples/cli_song.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Example of how to export PWM Pin and play tones via CLI + +export WIRINGPI_DEBUG=true +export WIRINGPI_CODES=true +GPIO=../gpio/gpio + +$GPIO export 1 out +$GPIO mode 1 pwm +$GPIO pwmTone 1 1033 + +for i in 262 523 220 440 233 466 0 0 262 523 220 440 233 466 0 0 175 349 147 294 156 311 0 0 175 349 147 294 156 311 0 0 311 277 294 277 311 311 208 196 277 262 370 349 165 466 440 415 311 247 233 220 208 0 0 0 ; do + $GPIO pwmTone 1 $i; + sleep 0.15; +done