46 lines
934 B
C
46 lines
934 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "player.h"
|
|
#include "song.h"
|
|
#include <wiringPi.h>
|
|
#include "accelerometer.h"
|
|
|
|
|
|
void shutdown(void) {
|
|
//Diese Methode wird von beim beenden aufgerufen.
|
|
printf("Auf Wiedersehen!\n");
|
|
}
|
|
|
|
PI_THREAD (accelerometerupdater) {
|
|
while (updateAccelerometerValue() == 0) {
|
|
delay(10);
|
|
}
|
|
return 0; //Muss returned werden, da void *
|
|
}
|
|
|
|
|
|
int main(void) {
|
|
int t1;
|
|
atexit(shutdown);
|
|
if (setupSoftTone() != 0) {
|
|
printf("SoftTone konnte nicht initialisiert werden.\n");
|
|
exit(0);
|
|
}
|
|
|
|
t1 = piThreadCreate(accelerometerupdater);
|
|
if (t1 != 0) {
|
|
printf("Accelerometer Thread nicht gestartet.\n");
|
|
}
|
|
|
|
//Intro
|
|
play(intro, noteDurations, introlength);
|
|
|
|
|
|
//Main theme
|
|
play(melody, melodyNoteDurations, songlength);
|
|
|
|
//Accelerometer Thread beenden
|
|
killAccelerometerMeasure();
|
|
return 0;
|
|
}
|