Accelerometer eingebunden #1, Messung läuft in einem Thread
This commit is contained in:
8
player.c
8
player.c
@@ -1,6 +1,9 @@
|
||||
#include <wiringPi.h>
|
||||
#include <softTone.h>
|
||||
#include "player.h"
|
||||
#include "accelerometer.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define PIN 0 //Realer pin 11
|
||||
|
||||
@@ -9,6 +12,7 @@ int setupSoftTone(void) {
|
||||
int returncode = 0;
|
||||
returncode += wiringPiSetup(); //Braucht root Rechte
|
||||
returncode += softToneCreate(PIN);
|
||||
setupAccelerometer();
|
||||
return returncode; // >0 --> error
|
||||
}
|
||||
|
||||
@@ -29,7 +33,9 @@ void play(int *notes, int *durations, int songlength) {
|
||||
* Diese wird später mit dem Beschleunigungssensor
|
||||
* gesteuert. Vorerst sind es aber 30%
|
||||
*/
|
||||
pauseBetweenNotes = nDuration * 1.30;
|
||||
//pauseBetweenNotes = nDuration * 1.30;
|
||||
pauseBetweenNotes = nDuration * 1.30 - (getAccelData() * 38.0);
|
||||
|
||||
delay(pauseBetweenNotes);
|
||||
// Sicherheitshalber Ton ausschalten
|
||||
softToneWrite(PIN, 0);
|
||||
|
Reference in New Issue
Block a user