1.1k views
in GUI Development by
Hello there!

I'm currently getting used to EmWi running on my Raspberry Pi. In my project, I need a slider to control the volume of a speaker, but my problem is that I don't know how I can pass the variable to the command console. I have some buttons which execute || native{ system("python myScript.py"); } || an this works just fine.

For example, I just want to print the slider value to the console with "echo".  
Perhaps I need a placeholder or something like that.

It would be great if someone can help me and give me a hint.

Kind Regards

1 Answer

0 votes
by

Hello,

have you seen the question/answer concerning the RaspberryPi I/O? Maybe the usage of WiringPI and the referred articles are helpful....

Best regards,

Manfred.

by

Thanks for your quick response.

I have seen this post but I don't get an answer out of it. My problem isn't how I can control the GPIOs, instead, I want to call a python script (which already works) and pass the value of the slider as an argument in the shell-execute command. 

I think it could look like this:
native (sliderValue){ 
    system("python setVolume.py %s", sliderValue); 
}

Another option could be to build a string with the command and value combined in Chora and then pass it to native, and there the system command should execute this string.

I hope it's understandable :D

by
O.k. understood. Unfortunately, I'm not familiar with python...

In principle, you can place any C code within a native section. This means, you can create a C API that is accessible / controlled by the GUI application.

The remaining question is: How to make a python call with parameters from C.

Maybe somebody other can help on this question - or other forums are focused on python aspects...

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...