树莓派使用小记

安装系统

烧录镜像,略

设置静态IP

 $ sudo nano /etc/dhcpcd.conf

增加:

interface eth0
static ip_address=192.168.0.33/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

interface wlan0
static ip_address=192.168.0.3/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

 $ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

增加:

network={
ssid=“BZZWAN”
psk=“bigzhizhixxoo”
key_mgmt=WPA-PSK
}

ubuntu版本的固定IP设置

ubuntu 16.04 之前版本

修改/etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8

使配置生效

sudo /etc/init.d/networking restart
ubuntu 18.04 之后版本

修改/etc/netplan/50-cloud-init.yaml

network:
    version: 2
    ethernets:
        eth0:
            dhcp4: no
            optional: true
            addresses: [192.168.1.120/24]
            gateway4: 192.168.1.1
            nameservers:
              addresses: [114.114.114.114,8.8.8.8]
    wifis:
        wlan0:
            dhcp4: true
            optional: true
            access-points:
                "无线的SSID名":
                    password:无线密码

检查语法

sudo netplan generate

使配置生效

sudo netplan apply

关于netplan, 请参考这里: https://netplan.io

安装中文支持

安装中文字体

sudo apt-get install ttf-wqy-zenhei

安装拼音输入法

sudo apt-get install scim-pinyin

进入菜单配置

sudo raspi-config

选择change_locale,在Default locale for the system environment:中选择zh_CN.UTF-8

命令行修改别名

$ vi ~/.bashrc

增加:

alias ll=‘ls -l’

修改软件源

  1. 查找找到最新的软件源镜像:
    http://www.raspbian.org/RaspbianMirrors,
  2. 修改/etc/apt/sources.list
    	$ cd /etc/apt
    	# 备份
    	$ cp sources.list sources.list_back
    	# 修改
    	$ sudo nano sources.list   
    
  3. 更新软件源和软件
        # 更新软件源
        $ sudo apt-get update
        # 更新软件
        $ sudo apt-get upgrade
    

内核模块编译环境

$ uname -a

Linux raspberrypi 4.4.21-v7+ #911 SMP Thu Sep 15 14:22:38 BST 2016 armv7l GNU/Linux

$ sudo apt-cache search kernel-headers

kernel-package - utility for building Linux kernel related Debian packages
linux-libc-dev - Linux support headers for userspace development
raspberrypi-kernel-headers - Header files for the Raspberry Pi Linux kernel

$ sudo apt-get install raspberrypi-kernel-headers

将在/usr/src目录下生成两个文件夹linux-headers-4.4.21+ 和 linux-headers-4.4.21-v7+

BCM2835 C Library 安装

$ wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.52.tar.gz  
$ tar xvzf bcm2835-1.52.tar.gz   
$ cd bcm2835-1.52  
$ ./configure  
$ make  
$ sudo make check   
$ sudo make install  

wiringPi安装

git clone源码,进入目录后编译并安装

$ git clone git://git.drogon.net/wiringPi
$ cd wiringPi
$ ./build

读取所有引脚定义

$ gpio readall

WiringPi中的函数类似于Arduino的wiring系统:
https://github.com/WiringProject

重启

$ sudo reboot
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值