Jakob changed some comments on bill's computer

This commit is contained in:
Bill Verplank 2013-01-25 11:14:52 +01:00
parent 0f8eb0f54d
commit b0bce01fac
2 changed files with 28 additions and 23 deletions

View File

@ -7,14 +7,15 @@
#include "Motor.h" #include "Motor.h"
#include "Music.h" #include "Music.h"
int pos; // position from analogRead int posA, posB; // position from analogRead
int force; // computed from pos and k int forceA, forceB; // computed from pos and k
int k = 2; // spring constant int kA, kB = 2; // spring constant
int duty; // pwm duty for Timer1 (range 0 - 1023) 10-bit resolution //int duty; // pwm duty for Timer1 (range 0 - 1023) 10-bit resolution
void setup() void setup()
{ {
MotorA.init(); MotorA.init();
MotorB.init();
Music.init(); Music.init();
} }
@ -22,15 +23,19 @@ void setup()
void loop() void loop()
{ {
pos = analogRead(A0); posA = analogRead(A0);
posB = analogRead(A3);
Music.setFrequency(pos); Music.setFrequency1(posA);
Music.setFrequency2(posB);
force = k * (512 - pos); forceA = - kA * (512 - posA);
forceB = - kB * (512 - posB);
//duty = abs(force); //duty = abs(force);
//duty = min(512, duty); //duty = min(512, duty);
MotorA.torque(force); MotorA.torque(forceA); //force can be -512 to +511
MotorB.torque(forceB); //force can be -512 to +511
//if(force < 0) MotorA.direction(FORWARD); //if(force < 0) MotorA.direction(FORWARD);
//else MotorA.direction(BACKWARD); //else MotorA.direction(BACKWARD);

View File

@ -74,26 +74,26 @@ public:
void setDetune1(float detune); void setDetune1(float detune);
void setDetune2(float detune); void setDetune2(float detune);
void setDetune3(float detune); void setDetune3(float detune);
void pitchBend(float b); void pitchBend(float b); // NOT IMPLEMENTED
// WAVEFORM FUNCTIONS // WAVEFORM FUNCTIONS
void setWaveform(uint16_t waveForm); void setWaveform(uint16_t waveForm); // JUST FOR 8bit WAVEFORMS
void setWaveform1(uint16_t waveForm); void setWaveform1(uint16_t waveForm); //
void setWaveform2(uint16_t waveForm); void setWaveform2(uint16_t waveForm); //
void setWaveform3(uint16_t waveForm); void setWaveform3(uint16_t waveForm); //
// GAIN FUNCTIONS // GAIN FUNCTIONS
void setGainFloat(float value); // 0.0 - 1.0 void setGainFloat(float value); // 0.0 - 1.0
void setGain16bit(uint16_t value); // 0 - 65535 void setGain16bit(uint16_t value); // 0 - 65535
void setGain(uint16_t value); // 0 - 65535 void setGain(uint16_t value); // 0 - 65535
void setGain(float value); // 0.0 - 1.0 void setGain(float value); // 0.0 - 1.0 USE THIS
void setGain1(uint16_t value); // 0 - 65535 void setGain1(uint16_t value); // 0 - 65535
void setGain2(uint16_t value); // 0 - 65535 void setGain2(uint16_t value); // 0 - 65535
void setGain3(uint16_t value); // 0 - 65535 void setGain3(uint16_t value); // 0 - 65535
void setGain1(float value); // 0.0 - 1.0 void setGain1(float value); // 0.0 - 1.0 USE THIS
void setGain2(float value); // 0.0 - 1.0 void setGain2(float value); // 0.0 - 1.0 USE THIS
void setGain3(float value); // 0.0 - 1.0 void setGain3(float value); // 0.0 - 1.0 USE THIS
float getGainFloat(); float getGainFloat(); // 0.0 - 1.0 USE THIS
uint16_t getGain(); uint16_t getGain();
// NOTE FUNCTIONS // NOTE FUNCTIONS
@ -101,7 +101,7 @@ public:
void noteOn(uint8_t note); // 0 - 255 void noteOn(uint8_t note); // 0 - 255
void noteOff(uint8_t note); // 0 - 255 void noteOff(uint8_t note); // 0 - 255
void noteOff(); void noteOff();
uint16_t getNoteFrequency(uint8_t note); // 0 - 127 uint16_t getNoteFrequency(uint8_t note); // 0 - 127 CHECK THIS OUT
// ENVELOPE FUNCTIONS // ENVELOPE FUNCTIONS
void enableEnvelope(); void enableEnvelope();
@ -113,10 +113,10 @@ public:
void setSustain16bit(uint16_t sus); // 0 - 65535 void setSustain16bit(uint16_t sus); // 0 - 65535
void setRelease16bit(uint16_t rel); // 0 - 65535 void setRelease16bit(uint16_t rel); // 0 - 65535
void setAttack(uint8_t att); // 0 - 127 void setAttack(uint8_t att); // 0 - 127 USE THESE ONES
void setDecay(uint8_t dec); // 0 - 127 void setDecay(uint8_t dec); // 0 - 127 USE THESE ONES
void setSustain(uint8_t sus); // 0 - 127 void setSustain(uint8_t sus); // 0 - 127 USE THESE ONES
void setRelease(uint8_t rel); // 0 - 127 void setRelease(uint8_t rel); // 0 - 127 USE THESE ONES
void setVelSustain(uint8_t vel); // 0 - 127 void setVelSustain(uint8_t vel); // 0 - 127
void setVelPeak(uint8_t vel); // 0 - 127 void setVelPeak(uint8_t vel); // 0 - 127