|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
|
|
#define PIN_DATA_VOL_A 8
|
|
|
|
|
#define PIN_DATA_VOL_B 7
|
|
|
|
@ -106,6 +107,11 @@ void switchInputs(uint8_t channel, bool state) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t logify(uint8_t volumelinear){
|
|
|
|
|
double volumelog=log10( ((double)volumelinear)/10.0 +1)*97;
|
|
|
|
|
return (int)volumelog;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// control a M62429 Chip for Volume Control
|
|
|
|
|
// function take from here: http://forum.arduino.cc/index.php?topic=244152.0
|
|
|
|
|
void setVolume(uint8_t volume, uint8_t dataPin) {
|
|
|
|
@ -171,7 +177,7 @@ void loop() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int vol=ser.substring(2).toInt();
|
|
|
|
|
setVolume(vol,datapin);
|
|
|
|
|
setVolume(logify(vol),datapin);
|
|
|
|
|
|
|
|
|
|
} else if(command == 'r') { // relais
|
|
|
|
|
|
|
|
|
|