Current version of the OpenAuto Pro is 12
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ability to have user-defined buttons that drive gpio
#1
Hi all,

It would be a nice addition to have user-defined buttons that can drive a gpio pin high or low and have a different icon and/or label text for both on/off states. For my application, I want to control a relay that would turn my amplifiers on or off.

Currently I'm gonna use the existing external application mechanism to get by, but the user experience is not going to be great.
Reply
#2
(10-31-2020, 05:30 PM)waj334 Wrote: Hi all,

It would be a nice addition to have user-defined buttons that can drive a gpio pin high or low and have a different icon and/or label text for both on/off states. For my application, I want to control a relay that would turn my amplifiers on or off.

Currently I'm gonna use the existing external application mechanism to get by, but the user experience is not going to be great.
I to am looking to link other devices to my GPIO to control my hvac system on my vehicle. Did you have any luck setting up user defined buttons within openaudio. If not were you able to access your external application through openaudio?
Reply
#3
You have to edit openauto_applications.ini configuration file.

Have a look at this: https://bluewavestudio.io/community/show...p?tid=2049
Reply
#4
There is an external application you could try.  Very useful for many things.
RPIEasy
"The glass is twice as big as it needs to be".
Reply
#5
(12-14-2020, 10:28 PM)3063DPrinting Wrote:
(10-31-2020, 05:30 PM)waj334 Wrote: Hi all,

It would be a nice addition to have user-defined buttons that can drive a gpio pin high or low and have a different icon and/or label text for both on/off states. For my application, I want to control a relay that would turn my amplifiers on or off.

Currently I'm gonna use the existing external application mechanism to get by, but the user experience is not going to be great.
I to am looking to link other devices to my GPIO to control my hvac system on my vehicle. Did you have any luck setting up user defined buttons within openaudio. If not were you able to access your external application through openaudio?

I turned my touch screen into a button map using a python app - that triggers relays.  The relays act as physical buttons connected to the Stack display unit.

Reply
#6
Which software or text editor did you use to make your GUI?
Reply
#7
(12-17-2020, 03:26 PM)3063DPrinting Wrote:
(12-17-2020, 07:29 AM)Justindu Wrote:
(12-14-2020, 10:28 PM)3063DPrinting Wrote:
(10-31-2020, 05:30 PM)waj334 Wrote: Hi all,

It would be a nice addition to have user-defined buttons that can drive a gpio pin high or low and have a different icon and/or label text for both on/off states. For my application, I want to control a relay that would turn my amplifiers on or off.

Currently I'm gonna use the existing external application mechanism to get by, but the user experience is not going to be great.
I to am looking to link other devices to my GPIO to control my hvac system on my vehicle. Did you have any luck setting up user defined buttons within openaudio. If not were you able to access your external application through openaudio?

I turned my touch screen into a button map using a python app - that triggers relays.  The relays act as physical buttons connected to the Stack display unit.
Which software or text editor did you use to make your GUI?

This is a hand coded Python app. I started on my Mac in a text editor called Atom, and eventually finished development on the Pi unit using a text editor called nano.

But, based on your question, I'm going to assume you are new to Python programming.  Python is easy enough to learn, but it takes time to work out something as complex as a custom GUI.

Here is an example of a very simple program that launches, paints a full screen button on a 1920x1200 display that has one function - to write a file, create a button, and then on touch of the button, it deletes the file then closes.

import tkinter as tk
import os
import pygame
pygame.mixer.init()

from subprocess import Popen #to execute unix commands wout blocking
root = tk.Tk()
root.title('RearView')

#def playsound():
#    pygame.mixer.music.load("./DashControl/Tink.wav")
#    pygame.mixer.music.play()

def CamDisplayOn():
    Popen(["touch", "/tmp/backupcamera_manual"])
    #playsound()

def CamDisplayOff():
    Popen(["rm", "/tmp/backupcamera_manual"])

def ButtonDown(event):
    #playsound()
    ##event button map
    if ((0 <= event.x <= 1920) and (0 <= event.y <= 1200)):
        print("CamDisplayOff") #delete /tmp/backupcamera_manual
        CamDisplayOff()
        exit()

##write the file on open and display the camera video
CamDisplayOn()

##setup the application window attributes
root.wm_attributes('-fullscreen','true') #Set window full fullscreen
root['bg'] = 'black' #set the background color
frame = tk.Frame(root, width=1920, height=1200) #set the app window size
filename = tk.PhotoImage(file = "./wallpaper.png") #set the background image file location
background_label = tk.Label(root, image=filename) #create a label to place on the Frame
background_label.place(x=0, y=0, relwidth=1, relheight=1) #place the label on frame
##bind mouse events to the background_label
background_label.bind("", ButtonDown)

frame.pack()
background_label.tkraise()
root.mainloop()
Reply
#8
I am new to python. I have a little experience with Arduino and visual basic code. I am in the early stages of integrating a PI into my restomod project. My goal is to make a application to control servo motors that are attached to my HVAC system and a few miscellaneous relays. I would like to access the application through Openauto pro. I have played around with Atom, Sublim text, Pycharm, and visual studio code. But I am having a hard time building and attractive GUI for my application. I am starting to play around with QtDesign and hope I can make something aesthetically pleasing and functional. Any suggestions would be appreciated, and if you know of any youtube tutorials that would be amazing.
Reply
#9
(12-17-2020, 07:35 PM)3063DPrinting Wrote: I am new to python. I have a little experience with Arduino and visual basic code. I am in the early stages of integrating a PI into my restomod project. My goal is to make a application to control servo motors that are attached to my HVAC system and a few miscellaneous relays. I would like to access the application through Openauto pro. I have played around with Atom, Sublim text, Pycharm, and visual studio code. But I am having a hard time building and attractive GUI for my application. I am starting to play around with QtDesign and hope I can make something aesthetically pleasing and functional. Any suggestions would be appreciated, and if you know of any youtube tutorials that would be amazing.

Page 5 has 1st episode. not YouTube but....  this one is retired but I still learned a lot and best coding walkthrough that was thorough.

https://twit.tv/shows/coding-101
Tested build hardware that works!!!

https://bluewavestudio.io/community/show...p?tid=2106
Reply
#10
I also would find this feature useful, as opposed to having to call an external application to perform GPIO setting functions.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)