Gordon Henderson 25e4ec570b Big update here.
delayMicrosecondsHard re-written - again.
Added a serialRead example program, and added in the okLed
to the examples too.
Updated/checked some of the GPIO/PWM code.
Added in some experimental servo and tone generating code and
and example or 2.
Tweaks to the gpio command to correctly load the I2C modules too.
2012-12-06 21:49:41 +00:00

38 lines
536 B
C

#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <wiringPi.h>
#include <softTone.h>
#define RANGE 100
#define NUM_LEDS 12
int scale [8] = { 262, 294, 330, 349, 392, 440, 494, 525 } ;
int main ()
{
int i, j ;
char buf [80] ;
if (wiringPiSetup () == -1)
{
fprintf (stdout, "oops: %s\n", strerror (errno)) ;
return 1 ;
}
softToneCreate (3) ;
for (;;)
{
for (i = 0 ; i < 8 ; ++i)
{
printf ("%3d\n", i) ;
softToneWrite (3, scale [i]) ;
delay (500) ;
}
}
}