update notes to motion.cpp

This commit is contained in:
Jakob Bak 2013-03-21 11:35:29 +01:00
parent c10d2e5b0c
commit 4e8ad1e132
2 changed files with 25 additions and 1 deletions

View File

@ -61,7 +61,7 @@ void Motion::update_mass_spring_damper() {
long t = millis(); long t = millis();
float dt = (float)(t - tick) / 100.0f; float dt = (float)(t - tick) / 100.0f;
int xin = analogRead(_s); // may take some time int xin = analogRead(_s); // may take some time, put: 512 - analogRead(_s);
Xin = xin; Xin = xin;
F = k * (xin - X) - (d * V); F = k * (xin - X) - (d * V);

View File

@ -1,5 +1,13 @@
<<<<<<< HEAD:software/lib/MMM/examples/Motion/_6_Bumps/_6_Bumps.ino
//Plucks - four bumps / three notes (400,500,600hz) //Plucks - four bumps / three notes (400,500,600hz)
#define NUM_OSCILLATORS 3 #define NUM_OSCILLATORS 3
=======
//plucks - four bumps
//three notes (400,500,600hz)
//can't get Music.setGain1, etc to work only Music.setGain() starts all of them.
#define NUM_OSCILLATORS 3
#define BIT_DEPTH 8
>>>>>>> update notes to motion.cpp:software/apps/Modeling/Bumps4/Bumps4.ino
#include <Music.h> #include <Music.h>
#include <Motor.h> #include <Motor.h>
@ -26,6 +34,7 @@ void loop(){
if (((xold <= 125) && (x > 125)) || ((xold >= 125) && (x < 125))){ if (((xold <= 125) && (x > 125)) || ((xold >= 125) && (x < 125))){
Music.setGain1(1.0f); Music.setGain1(1.0f);
<<<<<<< HEAD:software/lib/MMM/examples/Motion/_6_Bumps/_6_Bumps.ino
} }
if (((xold <= 375) && (x > 375)) || ((xold >= 375) && (x < 375))){ if (((xold <= 375) && (x > 375)) || ((xold >= 375) && (x < 375))){
Music.setGain2(1.0f); Music.setGain2(1.0f);
@ -35,6 +44,21 @@ if (((xold <= 625) && (x > 625)) || ((xold >= 625) && (x < 625))){
} }
if (((xold <= 875) && (x > 875)) || ((xold >= 875) && (x < 875))){ if (((xold <= 875) && (x > 875)) || ((xold >= 875) && (x < 875))){
Music.setGain1(1.0f); Music.setGain1(1.0f);
=======
Music.setFrequency1(200);
}
if (((xold <= 375) && (x > 375)) || ((xold >= 375) && (x < 375))){
Music.setGain2(1.0f);
Music.setFrequency2(250);
}
if (((xold <= 625) && (x > 625)) || ((xold >= 625) && (x < 625))){
Music.setGain3(1.0f);
Music.setFrequency3(300);
}
if (((xold <= 875) && (x > 875)) || ((xold >= 875) && (x < 875))){
Music.setGain1(1.0f);
Music.setFrequency1(400);
>>>>>>> update notes to motion.cpp:software/apps/Modeling/Bumps4/Bumps4.ino
} }
else{ else{
Music.setGain1(0.995f*Music.getGain1()); Music.setGain1(0.995f*Music.getGain1());