2/12/2024 0 Comments Xquartz ssh pygame![]() Using Pi to create an interactive sound boxĪ really fun activity is playing music using fruit and other conductive things (even humans)! You can do this by connecting the fruit to a computer using a touch sensor that in effect treats them as a key on the keyboard, making it possible to activate sounds when they are touched. See my previous post or the official Raspberry Pi website on how to setup your Pi. This post assumes that you have a Raspberry Pi B+ setup and connected (either to a monitor or running in headless mode). In this post, I will describe my experience using Raspberry Pi with a touch sensor to create an interactive sound box. You have to make sure that your script has execution privileges (set them with chmod) and you are set! In this file, you specify your icon, path, …: Depending on your needs you might or might not need to call from a terminal.Ī final bonus tip (thanks to the information here)! If you would like to make a desktop shortcut with an icon that you can double click to start your program, you need to create a file in the Desktop directory: The last command specifies that I want my script to be called from a terminal. So it will look something like this: -profile -desktop -profile -e /home/pi/Foad/myProgramLaunch.sh In this file you have to add your particular program path to the end of the list. In Raspbian Jessie, you want to change the autostart file in the. There are many forum posts about where and how to change files to make this happen but it is important that you locate and change the right file for your particular setup. If you want your script to run at the beginning (with no graphical support), please see my previous post here. I particularly wanted the program to run once the GUI is loaded. The next interesting challenge was to run my custom python code (or the shell script running it) on startup. In case your RPi Zero cannot use the display, comment out the added lines above and also copy the nf file form the HDMI folder to the X11 folder and everything should work on startup. Note: This might cause a problem if you plan to use a Raspberry Pi Zero. Sudo cp /home/pi/displays/TFT/nf /etc/X11/ Sudo cp /home/pi.displays/HDMI/nf /etc/X11/ ![]() Then add these lines to the script: if (/usr/bin/tvservice -s | /bin/egrep 'HDMI|DVI) then The solution I came up with involves modifying (or creating if it doesn’t exist) the rc.local file in the /etc/ folder: cd etc One thing to note is to the best of my knowledge, you can’t run the GUI simultaneously on the touch screen and the HDMI TV because the system can’t handle input from two sources. If an HDMI cable was not detected then I wanted the GUI to run on the touchscreen. In any case, the first issue I had to figure out was how to automatically detect if the Pi was connected to the HDMI screen and then run the GUI from there. For implementing my particular GUI (which I will discuss in a future post) I used pygame to interact both with the touch screen and the GPIO pins. ![]() I will have more application focused posts in the future (once I actually figure out the rest of my issues!).įor my implementation, I am using a Raspbian Jessie installation. Please note that this is a fairly technical post that is aimed to help others who are running into similar challenges. ![]() May be install the XQuartz 2.7.So for my particular setup, where I wanted to use a large HDMI screen to write my program and then use the Touch Screen to test it, I needed to figure out a bunch of things that I will explain in this post. I am still confused, what should I do next. After I execute echo $DISPLAY, the terminal just output blank space. But it didn't automatically set the DISPLAY like yours /private/tmp/0S1Q/org.xquartz:0. I use the brew install xquartz, and it installs the latest version. Actually, I reinstall xquartz2.8 for several times. But that's under the condition that the DISPLAY variable is set correctly. This includes ssh -X, provided that XAuthLocation has been set correctly, see #174. On my Mac (Intel MacBook Pro, MacOS Monterey 12.1, XQuartz 2.7.11), I managed to get what you seem to want: every X11 application that I start from a normal MacOS Terminal starts XQuartz for me automatically. Note that the XQuartz installation should do this for you automatically, without you having to tinker with it. This should mean that every attempt to access the X11 display on the Mac should cause launchd to start XQuartz if it isn't already running.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |