树莓派4B初探
简书链接:树莓派4B初探
文章字数:1692,阅读全文大约需要6分钟
刷入后默认密码是pi pwd 12345678
默认是个pi的热点 ,ip 192.168.1.1 如果再把网线连上去,那么连上这个热点是可以上网的。
ssh默认开启的,密码是Raspberry
关于热点关闭问题,
网上说是在/etc/rc.local注释相关代码,而我的没有。
网上说
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
我纳闷卖家提供刷入的怎么默认有wifi,我怀疑我的被人改乱了
1 | ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev |
经过测试我配置上我的wifi没效果。
etc/network/interfaces配置 wifi
1 | # interfaces(5) file used by ifup(8) and ifdown(8) |
测试后发现可以244联网了,之前192.168.1.1的远程地址连不上了,说明是生效了,但是纳闷的是图形界面显示的是X,而且我ping baidu是不通的。
ok,注释掉。
另外附加上本地lan的,不过我这都没效果,如果全部配置上,那wifi是脸上的,我能内网远程连上,但是ping不通,lan也不行,如果只配置lan,我发现并没有连上lan,wifi热点还在,但是,然后。。
1 | auto lo |
继续探索etc/dhcpd.conf方案
文件内容如下
1 | # A sample configuration for dhcpcd. |
其中lan0是我放开的,发现并没有连接上,我不配置他还连接上了,是默认的动态的,固定ip这么难的吗?我感觉要刷官方的系统,这都被改乱了
这里192.168.1.1/24大概就是这里产生热点的地方
总之,玩死了研究串口救砖还是usb转hdpi我感觉我还是重装吧
https://downloads.raspberrypi.org/raspios_arm64/images/
参考文章
https://blog.csdn.net/Naiva/article/details/105197196?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-0-105197196-blog-106721491.235^v38^pc_relevant_sort_base1&spm=1001.2101.3001.4242.1&utm_relevant_index=3
https://blog.csdn.net/taw19960426/article/details/106721491
https://blog.csdn.net/zhf_sy/article/details/108873788
https://blog.csdn.net/SoftwarerRJY/article/details/95877052
https://www.cnblogs.com/keygle/archive/2013/04/27/3048273.html
https://zhuanlan.zhihu.com/p/458102755
https://blog.csdn.net/Edwinwzy/article/details/129140494
https://blog.csdn.net/ziqifeinv/article/details/79036452
https://www.jianshu.com/p/bd918ef98a4d
2023-11-8 19:16:49
今天我用我的pve 工控机插上 了usb读卡器,然后看到了设备
1 | fdisk -l |
直接进入 /dev/sda2是进不去的
所以 mkdir /mnt/test
然后mount /dev/sda2 /mnt/test
然后df -m /dev/sda2
可以看到挂载点了
ok,不需要hdmi线和开启串口也可以了。
1 |
|
Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
Inform the DHCP server of our hostname for DDNS.
hostname
Use the hardware address of the interface for the Client ID.
clientid
or
Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
Some non-RFC compliant DHCP servers do not reply with this set.
In this case, comment out duid and enable clientid above.
#duid
Persist interface configuration when dhcpcd exits.
persistent
Rapid commit support.
Safe to enable by default because it requires the equivalent option set
on the server to actually work.
option rapid_commit
A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
Respect the network MTU. This is applied to DHCP routes.
option interface_mtu
Most distributions have NTP support.
#option ntp_servers
A ServerID is required by RFC2131.
require dhcp_server_identifier
Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
OR generate Stable Private IPv6 Addresses based from the DUID
slaac private
interface wlan0
static ip_address=192.168.2.244/24
static routers=192.168.2.1
static domain_name_servers=192.168.2.1 8.8.8.8
1 | 识别wpa_文件 |
#auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
1 | 至于直接设置密码的上面已经提到了,没有网的问题,关闭热点,设置了dns |
#include <wiringPi.h>
#include <stdio.h>
#define LEDPin 21
int main(){
printf(“hello”);
wiringPiSetup();
pinMode(LEDPin,OUTPUT);
int i=0;
for(;;){
digitalWrite(LEDPin,1);//ON
delay(500);
digitalWrite(LEDPin,0);
delay(500);
if(i>5){
break;
}
i++;
}
;
}
1 |  |
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
LEDPin=29# FROM 5—-HEAD 29
GPIO.setmode(GPIO.BOARD)
GPIO.setup(LEDPin,GPIO.OUT)
GPIO.output(LEDPin,GPIO.HIGH)
try:
while True:
print ‘led on’
GPIO.output(LEDPin,GPIO.LOW)
time.sleep(0.5)
print ‘led off’
GPIO.output(LEDPin,GPIO.HIGH)
time.sleep(0.5)
except KeyboardInterrupt:
GPIO.output(LEDPin,GPIO.HIGH)
GPIO.cleanup()
1 | 这里是python2, t同样,执行即可,会发现灯一闪一闪 |
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
LEDPin=5
GPIO.setmode(GPIO.BCM)
GPIO.setup(LEDPin,GPIO.OUT)
GPIO.output(LEDPin,GPIO.HIGH)
if GPIO.input(LEDPin) == GPIO.HIGH:
print(‘HEIGHT’)
else:
print(‘LOW’)
try:
while True:
print ‘led on’
GPIO.output(LEDPin,GPIO.LOW)
time.sleep(0.5)
print 'led off'
GPIO.output(LEDPin,GPIO.HIGH)
time.sleep(0.5)
except KeyboardInterrupt:
GPIO.output(LEDPin,GPIO.HIGH)
GPIO.cleanup()

扩展板GPIO17对应的是这下面的GPIO0
扩展板是bcm牌子的 ,因此上面的读数GPIO17就是bcm的17

最后我的笔记
