树莓派2、3 介绍及点亮led灯

开题:【好东西,值得研究!】

标题:树莓派2代B model 上手初体验,不用显示器,Python GPIO 点亮一颗LED


【知识普及】

1,树莓派各版本对比:

树莓派2、3 介绍及点亮led灯_第1张图片


2,树莓派2代BModel 主板,图样


树莓派2、3 介绍及点亮led灯_第2张图片

树莓派2、3 介绍及点亮led灯_第3张图片


树莓派2、3 介绍及点亮led灯_第4张图片



树莓派2 代B GPIO 图树莓派2、3 介绍及点亮led灯_第5张图片


树莓派2、3 介绍及点亮led灯_第6张图片





【所需硬件】

一张TF卡,8G或者8G以上,我的是 【三星TF卡16g class10 EVO】

一根网线,让树莓派与路由器连接 

一个5V 500MA 的普通USB电源,为树莓派供电 ,我试过了,5V 500ma没问题

一个树莓派2代B 

一个普通路由器【如果你连路由器都没有,可以参照windows的网络共享功能】

一个LED,及导线俩根

一个1K电阻


【软件准备】

windows下操作::

【官方】树莓派统集合:

http://downloads.raspberrypi.org/

https://www.raspberrypi.org/downloads



下载【树莓派定制的Debian系统】

下载最新版树莓派Debian系统: http://downloads.raspberrypi.org/raspbian_latest

下载后得到文件:2015-09-24-raspbian-jessie.zip

解压这个压缩文件得到:2015-09-24-raspbian-jessie.img



下载【Win32DiskImager】

http://jaist.dl.sourceforge.net/project/win32diskimager/Archive/Win32DiskImager-0.9.5-install.exe


【写入Linux系统】

TF内存卡插入读卡器,读卡器插入电脑USB

打开Win32DiskImager,找到img文件,目标盘符为TF卡,点击write,大约10几分钟,OK!


确保路由器开启DHCP服务,以便于让树莓派开机就能得到IP地址

Win32DiskImager写入Sucessfully之后,把TF卡插在树莓派的TF卡槽,





【准备就绪,开机】

插好网线,与开启DHCP的路由器连接

插入USB电源,开机

打开路由器管理页面,在ARP映射可以看到多出一个树莓派的IP



Xshell下载:http://www.netsarang.com/products/xsh_overview.html

得到IP后,打开Xshell工具,ssh跟上树莓派的IP

ssh 10.11.12.100

账户:pi

密码:raspberry


【切换到root】

1
2
pi@raspberrypi ~ $  sudo  su
root@raspberrypi: /home/pi #


【更新源】晚上网速有些慢,我的用了15分钟

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
root@raspberrypi:~ # apt-get update
Get:1 http: //mirrordirector .raspbian.org jessie InRelease [15.0 kB]                                   
Get:2 http: //archive .raspberrypi.org jessie InRelease [13.3 kB]                             
Get:3 http: //mirrordirector .raspbian.org jessie /main  armhf Packages [8,962 kB]
Get:4 http: //archive .raspberrypi.org jessie /main  Sources [31.2 kB]
Get:5 http: //archive .raspberrypi.org jessie /ui  Sources [5,197 B]             
Get:6 http: //archive .raspberrypi.org jessie /main  armhf Packages [101 kB]                                                         
Get:7 http: //archive .raspberrypi.org jessie /ui  armhf Packages [7,639 B]                                                          
Ign http: //archive .raspberrypi.org jessie /main  Translation-en_GB                                                                 
Ign http: //archive .raspberrypi.org jessie /main  Translation-en                                                                    
Ign http: //archive .raspberrypi.org jessie /ui  Translation-en_GB                                                                   
Ign http: //archive .raspberrypi.org jessie /ui  Translation-en                                                                      
Get:8 http: //mirrordirector .raspbian.org jessie /contrib  armhf Packages [37.5 kB]                                                 
Get:9 http: //mirrordirector .raspbian.org jessie /non-free  armhf Packages [70.2 kB]                                                
Get:10 http: //mirrordirector .raspbian.org jessie /rpi  armhf Packages [1,356 B]                                                    
Ign http: //mirrordirector .raspbian.org jessie /contrib  Translation-en_GB                                                          
Ign http: //mirrordirector .raspbian.org jessie /contrib  Translation-en
Ign http: //mirrordirector .raspbian.org jessie /main  Translation-en_GB
Ign http: //mirrordirector .raspbian.org jessie /main  Translation-en
Ign http: //mirrordirector .raspbian.org jessie /non-free  Translation-en_GB
Ign http: //mirrordirector .raspbian.org jessie /non-free  Translation-en
Ign http: //mirrordirector .raspbian.org jessie /rpi  Translation-en_GB
Ign http: //mirrordirector .raspbian.org jessie /rpi  Translation-en
Fetched 9,244 kB  in  15min 48s (9,742 B /s )
Reading package lists... Done



【安装Python的GPIO库】


先安装python开发包

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
root@raspberrypi:~ # apt-get -y install python-dev 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
   libpython-dev libpython2.7-dev python2.7-dev
The following NEW packages will be installed:
   libpython-dev libpython2.7-dev python-dev python2.7-dev
0 upgraded, 4 newly installed, 0 to remove and 56 not upgraded.
Need to get 18.2 MB of archives.
After this operation, 25.7 MB of additional disk space will be used.
Get:1 http: //mirrordirector .raspbian.org /raspbian/  jessie /main  libpython2.7-dev armhf 2.7.9-2
Get:2 http: //mirrordirector .raspbian.org /raspbian/  jessie /main  python-dev armhf 2.7.9-1 [1,188 B]
13% [1 libpython2.7-dev 2,376 kB /17 .9 MB 13%] [2 python-dev 1,188 B /1 ,188                                                                         Get:3 http: //mirrordirector .raspbian.org /raspbian/  jessie /main  libpython-dev armhf 2.7.9-1 [19.6 kB]
Get:4 http: //mirrordirector .raspbian.org /raspbian/  jessie /main  python2.7-dev armhf 2.7.9-2 [281 kB]
Fetched 18.2 MB  in  13s (1,306 kB /s )                                     
Selecting previously unselected package libpython2.7-dev:armhf.
(Reading database ... 118460 files and directories currently installed.)
Preparing to unpack ... /libpython2 .7-dev_2.7.9-2_armhf.deb ...
Unpacking libpython2.7-dev:armhf (2.7.9-2) ...
Selecting previously unselected package libpython-dev:armhf.
Preparing to unpack ... /libpython-dev_2 .7.9-1_armhf.deb ...
Unpacking libpython-dev:armhf (2.7.9-1) ...
Selecting previously unselected package python2.7-dev.
Preparing to unpack ... /python2 .7-dev_2.7.9-2_armhf.deb ...
Unpacking python2.7-dev (2.7.9-2) ...
Selecting previously unselected package python-dev.
Preparing to unpack ... /python-dev_2 .7.9-1_armhf.deb ...
Unpacking python-dev (2.7.9-1) ...
Processing triggers  for  man -db (2.7.0.2-5) ...
Setting up libpython2.7-dev:armhf (2.7.9-2) ...
Setting up libpython-dev:armhf (2.7.9-1) ...
Setting up python2.7-dev (2.7.9-2) ...
Setting up python-dev (2.7.9-1) ...
root@raspberrypi:~ #





树莓派GPIO官方说明 https://pypi.python.org/pypi/RPi.GPIO

下载树莓派python GPIO库

1
2
3
4
5
6
7
8
9
10
11
12
13
root@raspberrypi:~ # mkdir /home/gpio
root@raspberrypi:~ # cd /home/gpio
root@raspberrypi: /home/gpio # wget https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.11.tar.gz
--2015-09-24 16:38:10--  https: //pypi .python.org /packages/source/R/RPi .GPIO /RPi .GPIO-0.5.11. tar .gz
Resolving pypi.python.org (pypi.python.org)... 43.249.72.223
Connecting to pypi.python.org (pypi.python.org)|43.249.72.223|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 27060 (26K) [application /octet-stream ]
Saving to: ‘RPi.GPIO-0.5.11. tar .gz’
 
RPi.GPIO-0.5.11. tar .gz           100%[======================>]  26.43K  94.0KB /s    in  0.3s   
 
2015-09-24 16:38:15 (94.0 KB /s ) - ‘RPi.GPIO-0.5.11. tar .gz’ saved [27060 /27060 ]
1
2
3
4
5
6
7
8
9
可以看到下载的GPIO库文件只有27K
root@raspberrypi: /home/gpio # ls -lh
-rw-r--r-- 1 root root 27K May 14 18:27 RPi.GPIO-0.5.11. tar .gz
 
 
解压并进入目录
root@raspberrypi: /home/gpio # tar xf RPi.GPIO-0.5.11.tar.gz 
root@raspberrypi: /home/gpio # cd RPi.GPIO-0.5.11
root@raspberrypi: /home/gpio/RPi .GPIO-0.5.11 #


安装GPIO库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
root@raspberrypi: /home/gpio/RPi .GPIO-0.5.11 # python setup.py install
running  install
running build
running build_py
creating build
creating build /lib .linux-armv7l-2.7
creating build /lib .linux-armv7l-2.7 /RPi
copying RPi /__init__ .py -> build /lib .linux-armv7l-2.7 /RPi
running build_ext
building  'RPi.GPIO'  extension
creating build /temp .linux-armv7l-2.7
creating build /temp .linux-armv7l-2.7 /source
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror= format -security -fPIC -I /usr/include/python2 .7 -c  source /py_gpio .c -o build /temp .linux-armv7l-2.7 /source/py_gpio .o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror= format -security -fPIC -I /usr/include/python2 .7 -c  source /c_gpio .c -o build /temp .linux-armv7l-2.7 /source/c_gpio .o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror= format -security -fPIC -I /usr/include/python2 .7 -c  source /cpuinfo .c -o build /temp .linux-armv7l-2.7 /source/cpuinfo .o
source /cpuinfo .c: In  function  ‘get_rpi_info’:
source /cpuinfo .c:41:7: warning: ignoring  return  value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
        fgets(buffer, sizeof(buffer) , fp);
        ^
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror= format -security -fPIC -I /usr/include/python2 .7 -c  source /event_gpio .c -o build /temp .linux-armv7l-2.7 /source/event_gpio .o
source /event_gpio .c: In  function  ‘gpio_export’:
source /event_gpio .c:75:5: warning: ignoring  return  value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
      write(fd, str_gpio, len);
      ^
source /event_gpio .c: In  function  ‘gpio_unexport’:
source /event_gpio .c:90:5: warning: ignoring  return  value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
      write(fd, str_gpio, len);
      ^
source /event_gpio .c: In  function  ‘gpio_set_direction’:
source /event_gpio .c:106:9: warning: ignoring  return  value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
          write(fd,  "in" , 3);
          ^
source /event_gpio .c:108:9: warning: ignoring  return  value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
          write(fd,  "out" , 4);
          ^
source /event_gpio .c: In  function  ‘gpio_set_edge’:
source /event_gpio .c:124:5: warning: ignoring  return  value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
      write(fd, stredge[edge], strlen(stredge[edge]) + 1);
      ^
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror= format -security -fPIC -I /usr/include/python2 .7 -c  source /soft_pwm .c -o build /temp .linux-armv7l-2.7 /source/soft_pwm .o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror= format -security -fPIC -I /usr/include/python2 .7 -c  source /py_pwm .c -o build /temp .linux-armv7l-2.7 /source/py_pwm .o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror= format -security -fPIC -I /usr/include/python2 .7 -c  source /common .c -o build /temp .linux-armv7l-2.7 /source/common .o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror= format -security -fPIC -I /usr/include/python2 .7 -c  source /constants .c -o build /temp .linux-armv7l-2.7 /source/constants .o
arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror= format -security -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror= format -security build /temp .linux-armv7l-2.7 /source/py_gpio .o build /temp .linux-armv7l-2.7 /source/c_gpio .o build /temp .linux-armv7l-2.7 /source/cpuinfo .o build /temp .linux-armv7l-2.7 /source/event_gpio .o build /temp .linux-armv7l-2.7 /source/soft_pwm .o build /temp .linux-armv7l-2.7 /source/py_pwm .o build /temp .linux-armv7l-2.7 /source/common .o build /temp .linux-armv7l-2.7 /source/constants .o -o build /lib .linux-armv7l-2.7 /RPi/GPIO .so
running install_lib
creating  /usr/local/lib/python2 .7 /dist-packages/RPi
copying build /lib .linux-armv7l-2.7 /RPi/GPIO .so ->  /usr/local/lib/python2 .7 /dist-packages/RPi
copying build /lib .linux-armv7l-2.7 /RPi/__init__ .py ->  /usr/local/lib/python2 .7 /dist-packages/RPi
byte-compiling  /usr/local/lib/python2 .7 /dist-packages/RPi/__init__ .py to __init__.pyc
running install_egg_info
Writing  /usr/local/lib/python2 .7 /dist-packages/RPi .GPIO-0.5.11.egg-info
 
root@raspberrypi: /home/gpio/RPi .GPIO-0.5.11 # echo $?
0
可以看到,没有错误


编写一个程序,点亮LED!

注意: 这里使用GPIO.BOARD模式,对应的是主板物理引脚号的排序,也就是说pin1就是板子上的3V3. 

把led的负极接到板子上的GPIO.0(pin11) LED正极接一个1K的电阻,在接到5V上(pin2). 特别注意python的缩进.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
root@raspberrypi: /home/gpio/RPi .GPIO-0.5.11 # cd
root@raspberrypi:~ # vim test.py
#!/user/bin/python
import  RPi.GPIO as GPIO
import  time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11,GPIO.OUT)
while  True:
      GPIO.output(11,True)
      time . sleep (1)
      GPIO.output(11,False)
      time . sleep (1)
 
      运行程序
root@raspberrypi:~ # python test.py


【效果图】 ctrl+c用来终止程序







再来写一个检查按键的小程序:

按键一端接到GND(pin6),一端加到GPIO.1(PIN12)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
root@raspberrypi:~ # vim test2.py
#!/user/bin/python
import  RPi.GPIO as GPIO
import  time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11,GPIO.OUT)
GPIO.setup(12,GPIO.IN)
while  True:
     in_value= GPIO.input(12)
     if  in_value ==False:
        GPIO.output(11,False)
        time . sleep (1)
        GPIO.output(11,True)
        while  in_value == False:
           in_value = GPIO.input(12)


不按下按键,灯会以1HZ的频率闪烁  

按下按键,LED灯熄灭,松手,LED亮起!

【效果图】ctrl+c用来终止程序


gif动画没做好,不去碰按键,灯是1HZ闪烁状态的,

按下按键,LED是熄灭的。

物联网家居,开始折腾!


【树莓派关机命令】

root@raspberrypi:~# init 0

等2秒,可以拔电源了!





[树莓派新手入门基础命令】



查看CPU信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
root@raspberrypi: /home/pi # cat /proc/cpuinfo 
processor   : 0
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS    : 38.40
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer    : 0x41
CPU architecture: 7
CPU variant    : 0x0
CPU part   : 0xc07
CPU revision   : 5
 
processor   : 1
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS    : 38.40
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer    : 0x41
CPU architecture: 7
CPU variant    : 0x0
CPU part   : 0xc07
CPU revision   : 5
 
processor   : 2
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS    : 38.40
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer    : 0x41
CPU architecture: 7
CPU variant    : 0x0
CPU part   : 0xc07
CPU revision   : 5
 
processor   : 3
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS    : 38.40
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer    : 0x41
CPU architecture: 7
CPU variant    : 0x0
CPU part   : 0xc07
CPU revision   : 5
 
Hardware    : BCM2709
Revision    : a21041
Serial      : 000000000f4c5cc4
 
 
BCM2708 /9  属于处理器的家族
BCM2835 /6  属于处理的具体型号


为root设置密码

1
2
3
4
root@raspberrypi: /home/pi # passwd root
Enter new UNIX password:haha 
Retype new UNIX password: haha
passwd : password updated successfully
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
安装vim编辑器
root@raspberrypi: /home/pi # apt-get -y install vim
 
开启vim语法高亮
root@raspberrypi: /home/pi # vim /etc/vim/vimrc +19
去掉前面的引号“syntax on,改为下面的,按ESC,按 shift +zz保存退出
syntax on
 
开启root远程登录
root@raspberrypi: /home/pi # vim /etc/ssh/sshd_config  +28
把PermitRootLogin without-password改为下面的,按ESC,按 shift +zz保存退出
PermitRootLogin  yes
 
重启sshd服务
root@raspberrypi: /home/pi # service sshd restart
 
 
 
root@Ubuntu:~ # ssh 10.11.12.100 -l root
The authenticity of host  '10.11.12.100 (10.11.12.100)'  can't be established.
ECDSA key fingerprint is 42:6a:d5:02:d4:23:46:a6:da:00:24:8f:16:2c:c4:49.
Are you sure you want to  continue  connecting ( yes /no )?  yes
Warning: Permanently added  '10.11.12.100'  (ECDSA) to the list of known hosts.
[email protected]'s password: haha
 
The programs included with the Debian GNU /Linux  system are  free  software;
the exact distribution terms  for  each program are described  in  the
individual files  in  /usr/share/doc/ * /copyright .
 
Debian GNU /Linux  comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Sep 24 16:15:36 2015 from 10.11.12.14
root@raspberrypi:~
root远程 登录成功!




修改root的配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
root@raspberrypi:~ # vim .bashrc 
# ~/.bashrc: executed by bash(1) for non-login shells.
# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022
# You may uncomment the following lines if you want `ls' to be colorized:
  export  LS_OPTIONS= '--color=auto'
  eval  "`dircolors`"
  alias  ls = 'ls $LS_OPTIONS'
  alias  ll= 'ls $LS_OPTIONS -lh'
  alias  l= 'ls $LS_OPTIONS -lA'
#
# Some more alias to avoid making mistakes:
  alias  rm = 'rm -i'
  alias  cp = 'cp -i'
  alias  mv = 'mv -i'
  
  使配置立即生效,注意两个点之间的空格
  root@raspberrypi:~ # . .bashrc


查看推荐的源

1
2
3
4
root@raspberrypi: /home/pi # cat /etc/apt/sources.list
deb http: //mirrordirector .raspbian.org /raspbian/  jessie main contrib non- free  rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi



查看内存信息:看到的是1G的哈

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
root@raspberrypi:~ # cat /proc/meminfo 
MemTotal:         948120 kB
MemFree:          789508 kB
MemAvailable:     862084 kB
Buffers:           17436 kB
Cached:            79256 kB
SwapCached:            0 kB
Active:            85240 kB
Inactive:          46372 kB
Active(anon):      35252 kB
Inactive(anon):     6476 kB
Active( file ):      49988 kB
Inactive( file ):    39896 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:        102396 kB
SwapFree:         102396 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         35016 kB
Mapped:            37816 kB
Shmem:              6812 kB
Slab:              13516 kB
SReclaimable:       6344 kB
SUnreclaim:         7172 kB
KernelStack:        1136 kB
PageTables:         1868 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      576456 kB
Committed_AS:     521112 kB
VmallocTotal:    1105920 kB
VmallocUsed:        1188 kB
VmallocChunk:     900580 kB
CmaTotal:           8192 kB
CmaFree:            3740 kB



查看内存使用情况:

1
2
3
4
5
root@raspberrypi:~ # free -m
              total       used        free      shared    buffers     cached
Mem:           925        172        752          7         25         82
-/+ buffers /cache :         65        860
Swap:           99          0         99




查看磁盘挂载情况:

1
2
3
4
5
6
7
8
9
10
11
root@raspberrypi:~ # df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/root       ext4      3.9G  3.2G  515M  87% /
devtmpfs       devtmpfs  459M     0  459M   0%  /dev
tmpfs          tmpfs     463M     0  463M   0%  /dev/shm
tmpfs          tmpfs     463M  6.3M  457M   2%  /run
tmpfs          tmpfs     5.0M  4.0K  5.0M   1%  /run/lock

你可能感兴趣的:(树莓派3,python,centos)