http://sthurlow.com/python/
https://www.learnpython.org/
Default Pi login credentials:
User: pi
Password: raspberry
1. To start GUI write startx and to exit GUI write pkill x
2. sudo apt-get update
3. sudo apt-get upgrade
4. sudo apt-get install python-requests
5. Installing pip for python 2
sudo apt-get install python-pip
6. Installing libdbus
sudo apt-get install libdbus-1-dev
7. sudo pip install pathlib
8. Type ls to see the content of the current directory
9. To see available WiFi networks
sudo iwlist wlan0 scan | grep ESSID
10. To see the current network it's connected to
sudo iwgetid
11. sudo iwconfig
12. sudo ifconfig
13. To write python code in terminal type
python
14. To exit type
raise SystemExit
15. To run a python code write
python test.py
16. To exit
ctrl+c
16. If the python script needs admin authority or accesses GPIO then you need sudo
sudo python test.py
17. To run the script in a separate thread
sudo python test.py &
18. To exit
ctrl+d
19. To see the temperature, type
vcgencmd measure_temp
20. To configure RPi, type
sudo raspi-config
21. To pass audio through hdmi
Edit /boot/config.txt
hdmi_drive = 2
22. To hard code display resolution
Edit /boot/config.txt
hdmi_group = 2
hdmi_mode = 39 (for 1360x768)
Read this link for more details
23. To see the current resolution setting, type
fbset -s
24. To see the attached storage
df
25. To unmount flash drives
sudo umount /dev/sda1
26. Sudo raspi-config → cli
Cli in wheezy does not auto login
sudo nano /etc/inittab
1:2345:respawn:/sbin/getty --autologin pi --noclear 38400 tty1
To blank the screen after a minute →
/etc/kbd/config
BLANK_TIME=1
BLANK_DPMS=off
POWERDOWN_TIME=0 (note: not sure about this line more details here → link)
27. To clear boot messages when starting up append this bit to .bashrc file →
sudo clear
28. To install requests, update and upgrade first
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-requests
29. To change the keyboard setting with
sudo raspi-config
Select a generic keyboard and change country to US
30. print the name of my working directory
pwd
31. To access Pi via SSL you must enable SSL from raspi-config. To find the IP address and other network related information use the command "ifconfig". To find Pi in headless mode, connect Pi with an straight ethernet cable. Start up either Find My Pi tool by adafruit or Angry IP scanner and get the IP address of the Pi. Open putty and get in using the IP address.
32. To install PIL for working with images and icons using Tkinter for Python 2
sudo apt-get install python-imaging
sudo apt-get install python-imaging-tk
33. Tkinter won't run from cli so you will have to start the desktop interface. To run codes at start up edit .bashrc file and append the command sudo python yourTkinterTest.py to run your code. Now go to raspi-config and select boot to desktop mode. To load up the terminal automatically on desktop boot edit the following file:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
Append the following line at the end
@lxterminal
34. To disable Xsession (Desktop) from blanking add the following lines in the file mentioned in 33
@xset s noblank
@xset s off
@xset -dpms
35. Installing Eclipse Paho MQTT Python client library:
sudo apt-get update
sudo apt-get install python-smbus
sudo apt-get install mosquitto
git clone https://github.com/eclipse/paho.mqtt.python
cd paho.mqtt.python
sudo python setup.py install
36. To forget a network or add a new one from cmd edit the following line:
/etc/wpa_supplicant/wpa_supplicant.conf
The format is as follows:
network = {
ssid = ""
psk = ""
key_mgmt = WPA-PSK
}
Check this link for details.
No comments:
Post a Comment