chiark
/
gitweb
/
~ianmdlvl
/
wiringPi.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Big update here.
[wiringPi.git]
/
examples
/
tone.c
1
2
#include <stdio.h>
3
#include <errno.h>
4
#include <string.h>
5
6
#include <wiringPi.h>
7
#include <softTone.h>
8
9
#define RANGE 100
10
#define NUM_LEDS 12
11
12
int scale [8] = { 262, 294, 330, 349, 392, 440, 494, 525 } ;
13
14
int main ()
15
{
16
int i, j ;
17
char buf [80] ;
18
19
if (wiringPiSetup () == -1)
20
{
21
fprintf (stdout, "oops: %s\n", strerror (errno)) ;
22
return 1 ;
23
}
24
25
softToneCreate (3) ;
26
27
for (;;)
28
{
29
for (i = 0 ; i < 8 ; ++i)
30
{
31
printf ("%3d\n", i) ;
32
softToneWrite (3, scale [i]) ;
33
delay (500) ;
34
}
35
}
36
37
}