Accelerometer eingebunden #1, Messung läuft in einem Thread

This commit is contained in:
2016-09-12 20:54:58 +02:00
parent 6e78a15640
commit 5ba48280f9
5 changed files with 51 additions and 3 deletions

View File

@@ -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);