As a result, it's recommended that you only use rc.local for starting programs that do not have graphical elements.Īs your Linux operating system (OS) boots on your Raspberry Pi, it goes through a series of runlevels, which define the state of the system during startup. Running your program from rc.local is likely the easiest method, but because rc.local is executed before X starts, you will not have access to GUI elements. Your entire screen should be taken up by a rather large clock! Run the program with the following: language:shell Save it with ctrl + x, press y when asked to save, and press enter. # Schedule the poll() function to be called periodically # Have the resize() function be called every time the window is resized # Read values from the sensors at regular intervals # Use negative number for "pixels" instead of "points" # Resize font based on frame height (minimum size of 12) # Automatically resize font size based on window size Root.attributes('-fullscreen', fullscreen) # Toggle between fullscreen and windowed modes # Global variable to remember if we are fullscreen or windowed On your Raspberry Pi (in your home directory, /home/pi), open a new document with the name clock.py: language:shellĬopy in the following code: language:python We'll use this program when we want to demonstrate how to start a program on boot that requires the X windows system (for example, you want to make a graphical dashboard that is displayed on boot). ![]() The next example that we'll use is slightly more complicated, as it relies on a GUI made with the Tkinter package. Connect an LED and a 330 Ω resistor between GPIO12 and GND on the Raspberry Pi. While external connections to hardware is not necessary to show how to run a program on boot, it can be a useful way to show that something is running in the background, even if you do not see anything on the screen. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |