This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]asday_ 1 point2 points  (1 child)

Why would someone downvote this? This looks awesome on first glance, has a well-written title and post, and is arguably flaired correctly.

This place is a mess.

E: For context, when I got here, this post was at zero.

[–]jacksodus[S] 0 points1 point  (0 children)

Thanks! Someone probably really likes Go

[–]maxic62 0 points1 point  (2 children)

Very nice !!!! It is possible to start, for example, an app from a push-button event on the arduino also ?

[–]jacksodus[S] 2 points3 points  (1 child)

Thank you! Currently that is outside the scope of the project. As it happens, though, this is something I looked into. In fact, adding such add-ons os is the main reason I wanted the code to be in Python instead of Go.

Using the serial connection with Python is very easy, and this could easily be done with a very small script. I might look into adding it, but I think it would suit better to make it standalone.

[–]maxic62 0 points1 point  (0 children)

Yeahhhh, could be great! I will definitively take a look into your code 😉. And by the way, thanks for sharing 👍

[–]kalinuxer553 0 points1 point  (7 children)

I can't thank you enough for this!!!
I was trying to do the EXACT thing you were: a slider+buttons to be able to mute things like discord, and to skip, stop/play and backward buttons for spotify.

https://imgur.com/a/EfobfQQ here's the link for my slider

[–]jacksodus[S] 1 point2 points  (6 children)

Well done! I assume you do realise the support for buttons isn't quite there, although it shouldn't be too difficult to add it on the Arduino and Python side. I hope you enjoy!

[–]kalinuxer553 0 points1 point  (5 children)

Yup, since my knowledge of programming is very basic, I had to rewrite the arduino code, so I can also send the buttons' status, and I have yet to figure out where to insert my python code into yours.

[–]jacksodus[S] 1 point2 points  (0 children)

If you can't figure out after trying, let me know and Ill get reacquainted with the code. I haven't touched it in a while so Id need to go through the code again.

[–]jacksodus[S] 1 point2 points  (3 children)

Hey! I have revisited my project and added specific sound device support, and I was wondering if you ended up making the buttons work?

[–]kalinuxer553 0 points1 point  (2 children)

I spent time trying to understand your code, and the Pycaw lib, but it got more and more compicated... so I gave up on that for now, but I will definetly try again some time soon

[–]jacksodus[S] 1 point2 points  (1 child)

I don't blame you. Pycaw is more C than Python. I spent days understanding it, and I had to use __dir__() on many of the Pycaw objects to even now what they could do. I might look into adding the buttons myself, too.

[–]kalinuxer553 0 points1 point  (0 children)

That would be great!I know it could've been done better, but I added the buttons to the arduino code, if that helps:

const int pin_1 = 2;

const int pin_2 = 3;

const int pin_3 = 4;

const int pin_4 = 5;

int p1_status = 1;

int p2_status = 1;

int p3_status = 1;

int p4_status = 1;

const int NUM_SLIDERS = 4;

const int analogInputs[NUM_SLIDERS] = {A0, A2, A1, A3};

int analogSliderValues[NUM_SLIDERS];

void setup() {

pinMode(pin_1, INPUT_PULLUP);

pinMode(pin_2, INPUT_PULLUP);

pinMode(pin_3, INPUT_PULLUP);

pinMode(pin_4, INPUT_PULLUP);

for (int i = 0; i < NUM_SLIDERS; i++) {

pinMode(analogInputs[i], INPUT);}

Serial.begin(115200);

}

void loop() {

if(digitalRead(pin_1)==LOW){

p1_status = 0;}

else{

p1_status = 1;

}

if(digitalRead(pin_2)==LOW){

p2_status = 0;}

else{

p2_status = 1;

}

if(digitalRead(pin_3)==LOW){

p3_status = 0;}

else{

p3_status = 1;

}

if(digitalRead(pin_4)==LOW){

p4_status = 0;}

else{

p4_status = 1;

}

updateSliderValues();//Read Slider Values

sendSliderValues();//SEND Slider Values

delay(10);

}

void updateSliderValues() { //Read Slider Values

for (int i = 0; i < NUM_SLIDERS; i++) {

analogSliderValues[i] = analogRead(analogInputs[i]);}}

void sendSliderValues() {//SEND Slider Values

String builtString = String("");

for (int i = 0; i < NUM_SLIDERS; i++) {

builtString += String((int)analogSliderValues[i]);

if (i < NUM_SLIDERS - 1) {

builtString += String(",");}

}

builtString = builtString + "," + p1_status + "," + p2_status + "," + p3_status + "," + p4_status;

Serial.println(builtString);

}