You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So sorry to be making another post about this issue but I've tried disabling usb wake up in my device manager (the button to disable it just doesnt exist on my end for some reason) and I've also tried adjusting the arduino code based on #52 and I haven't been able to get my computer to remain in sleep while deej is running. Admittedly I don't know too much about programming arduinos so I'm not sure if I even inserted the new code in the correct way or into the correct spots. Here's what I have, please let me know what I'm doing wrong. Thanks in advance
const int NUM_SLIDERS = 9;
const int analogInputs[NUM_SLIDERS] = {A6, A7, A8, A9, A3, A2, A1, A0, A10};
String oldValues;
int analogSliderValues[NUM_SLIDERS];
int oldAnalogSliderValues[NUM_SLIDERS];
void setup() {
for (int i = 0; i < NUM_SLIDERS; i++) {
pinMode(analogInputs[i], INPUT);
oldAnalogSliderValues[i] = analogSliderValues[i] = analogRead(analogInputs[i]);
if(abs(oldAnalogSliderValues[i] - analogSliderValues[i]) <= 2) analogSliderValues[i] = oldAnalogSliderValues[i];
oldAnalogSliderValues[i] = analogSliderValues[i];
}
Serial.begin(9600);
}
void loop() {
updateSliderValues();
sendSliderValues(); // Actually send data (all the time)
// printSliderValues(); // For debug
delay(10);
}
void updateSliderValues() {
for (int i = 0; i < NUM_SLIDERS; i++) {
analogSliderValues[i] = analogRead(analogInputs[i]);
}
}
void sendSliderValues() {
String builtString = String("");
for (int i = 0; i < NUM_SLIDERS; i++) {
builtString += String((int)analogSliderValues[i]);
if (i < NUM_SLIDERS - 1) {
builtString += String("|");
}
}
if(oldValues != builtString) Serial.println(builtString); oldValues = builtString;
}
void printSliderValues() {
for (int i = 0; i < NUM_SLIDERS; i++) {
String printedString = String("Slider #") + String(i + 1) + String(": ") + String(analogSliderValues[i]) + String(" mV");
Serial.write(printedString.c_str());
if (i < NUM_SLIDERS - 1) {
Serial.write(" | ");
} else {
Serial.write("\n");
}
}
}
The text was updated successfully, but these errors were encountered:
Is it possible that the potentiometers being used fluctuate between values? Check with the debug function to see if there's a slight change in volume even when the potentiometers are not being used. You could implement a function in the code that only sends slider values when the change is significant enough (when the potentiometer is actually being adjusted).
However, please note that for the Deej program to function correctly, values must be sent continuously. Otherwise, it won't respond at all. In other words, if a potentiometer is not being used, always send a fixed value. Only update this fixed value when the change is significant enough to ensure that you are actually adjusting the potentiometer.
Is it possible that the potentiometers being used fluctuate between values? [...] You could implement a function in the code that only sends slider values when the change is significant enough (when the potentiometer is actually being adjusted).
[...] In other words, if a potentiometer is not being used, always send a fixed value. Only update this fixed value when the change is significant enough to ensure that you are actually adjusting the potentiometer.
I was under the impression that that's what the code adjustments in #52 were accomplishing.
But again, I'm not sure if I added the code to the correct spots in the code I posted earlier.
So sorry to be making another post about this issue but I've tried disabling usb wake up in my device manager (the button to disable it just doesnt exist on my end for some reason) and I've also tried adjusting the arduino code based on #52 and I haven't been able to get my computer to remain in sleep while deej is running. Admittedly I don't know too much about programming arduinos so I'm not sure if I even inserted the new code in the correct way or into the correct spots. Here's what I have, please let me know what I'm doing wrong. Thanks in advance
The text was updated successfully, but these errors were encountered: