600|2

46

帖子

0

TA的资源

一粒金砂(中级)

楼主
 

【DigiKey“智造万物,快乐不停”创意大赛】烧录镜像,vnc登陆,还没开始驱动gpio [复制链接]

 

关注引脚分配的情况,参考https://pinout.xyz/

在烧录镜像的方面,最好是参考 古月居的一篇博客,里面提到在镜像烧录的时候,最好用树莓派官方提供的工具,还有官方提供的镜像。

https://www.guyuehome.com/43433

 

1、如何连接vnc

Re: Issues setting up realVNC as complete beginner
Quote
Mon Oct 16, 2023 7:57 pm

Thanks for the reply! I've just used the OS recommended by the installer, which says it's a port of Debian Bookworm, I'm uncertain about Bookworm
or Wayland, but I'll make that my next point of research!

I've just finished trying again from scratch, and documented my actions step-by-step to hopefully better document and describe what I've tried, to
see if that helps. I believe in the process I tried both of your recommendations!

What I've attempted so far:

1. Erased 64 GB microSD card with Raspberry Pi Imager
2. Wrote Raspberry Pi OS (32-bit) to the microSD with Raspberry Pi Imager
3. Put microSD into RPi and powered on.
4. Connected to RPi from a Mac using
Code: Select all

$ ssh <user>@<hostname>.local
5. Encountered the following error:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the <redacted> key sent by the remote host is
<redacted>.
Please contact your system administrator.
Add correct host key in /Users/<user>/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/<user>/.ssh/known_hosts:3
Host key for <hostname>.local has changed and you have requested strict checking.
Host key verification failed.
6. Resolved this error by:
1. Identifying the IP address with ping <hostname>.local
2. Running the command
Code: Select all

$ ssh-keygen -R <IP address>
3. Ran
Code: Select all

$ ssh <user>@<hostname>.local
again which enabled connection after confirming with “yes” and entering my password
7. To enable realVNC on command line I:
1. Opened raspi-config with
Code: Select all

$ sudo raspi-config
2. Navigated to Interface Options -> VNC
3. Selected “YES” when asked “Would you like the VNC Server to be enabled?”
4. Navigated to Display Options -> VNC Resolution and selected 1920x1080
5. Navigated to System Options -> Boot/Auto Login and selected Desktop GUI, requiring user to login
6. Exited raspi-config and said yes to rebooting.
8. Once rebooted, connected again over ssh, then on a Mac I opened VNC viewer and entered the RPi’s IP address
9. I then again received the error
“Unable to connect to VNC Server using your chosen security setting. Either upgrade VNC Server to a more recent version from RealVNC, or select a
weaker level of encryption.”
10. I then logged in as root using
Code: Select all

$ sudo su
to see if root permissions would help alleviate the problem.
1. Opened raspi-config with
Code: Select all

sudo raspi-config
2. Navigated to Interface Options -> VNC
3. Selected “YES” when asked “Would you like the VNC Server to be enabled?”
4. Upon selecting “YES” I got the message
“The VNC Server is enabled” but it had overlayed this error on top “<ERROR: ../src/main.c: 386: Failed to connect to WAYLAND_DISPLAY="wayland-1"
│ └─────────────────ERROR: ../src/main.c: 387: Ensure wayland is running with that display name
ERROR: ../src/main.c: 1391: Failed to initialise wayland”
5. Not knowing what this error meant, I proceeded as before:
6. Navigated to Display Options -> VNC Resolution and selected 1920x1080
7. Navigated to System Options -> Boot/Auto Login and selected Desktop GUI, requiring user to login
8. Exited raspi-config and said yes to rebooting.
11. The same error as before then persisted when again attempting to connect with realVNC.
12. I then updated the RPi in case it was an issue with it being an old release by:
1. Running
Code: Select all

$ sudo apt update && sudo apt upgrade
2. Rebooting
3. Connecting again via ssh and opening raspi-config
4. Updated raspi-config via Option 8, Update
5. Rebooted
13. I then attempted to connect using VNC Viewer on a Mac again, and encountered the same aforementioned error.
14. I’ve since also run
Code: Select all

$ sudo apt-get update && sudo apt-get upgrade
as well as
Code: Select all

$ sudo apt full-upgrade
, none of these resulted in any change to the error either.

Looking back, the error I received the second time I tried enabling the VNC in raspi-config mentions Wayland, so I'll look into teaching myself
about that as a matter of urgency. Thanks again for any help!
User avatarrpiMike
Posts: 2674
Joined: Fri Aug 10, 2012 12:38 pm
Location: Cumbria, UK
Re: Issues setting up realVNC as complete beginner
Quote
Mon Oct 16, 2023 8:25 pm

RealVNC does not yet work on Bookworm as specified in the Bookworm news.

 

 

 

2、如何安装wiringpi

使用sudo apt-get install wiringpi 指令安装wiringpi包时,出现下面的提示:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package wiringpi is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'wiringpi' has no installation candidate

解决方案:

Gordon在该链接中写道树莓派Raspberry pi 4B版本中需要用到新的2.52的wiringpi包,安装方式为

cd /tmp
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb

链接已隐藏,如需查看请登录或者注册

The question shows different architectures armhf vs. arm64 for the packages.

dpkg: dependency problems prevent configuration of wiringpi:armhf:
 wiringpi:armhf depends on libc6.
          ^^^^^
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                  Version                   Architecture Description
+++-=====================-=========================-============-==============>
ii  libc6:arm64           2.31-13+rpt2+rpi1+deb11u2 arm64        GNU C Library:>
          ^^^^^
Apparently you try to install a 32-bit package on a 64-bit system.

In Seamus' answer there is some useful information which might get overlooked in the longer text telling opinion and explanation about the wiringpi project.

The wiringpi project has a GitHub site from which they distribute a .deb file that can be downloaded and installed - the links are at the bottom of the page. There are 2 .deb files - one for 32-bit RPi OS & one for 64-bit OS.

On the Releases page of this GitHub project you can see two versions of the package:

wiringpi-2.61-1-arm64.deb
wiringpi-2.61-1-armhf.deb
Try to purge the armhf version and install the arm64 version.

 

3、led代码blink.c的编译


GCC编译bink.c生成bink程序的代码如下:

#include <wiringPi.h>

int main(void)
{
    wiringPiSetup();
    pinMode(0, OUTPUT);

    while(1)
    {
        digitalWrite(0, HIGH);
        delay(500);
        digitalWrite(0, LOW);
        delay(500);
    }

    return 0;
}

gcc -Wall -o blink blink.c -lwiringPi
sudo ./blink

gcc -o blink blink.c -lwiringPi

http://wiringpi.com/wiringpi-updated-to-2-52-for-the-raspberry-pi-4b/


4、远程登陆到树莓派,在终端中输入「gpio readall」,可获取到引脚对应关系,
wiringPi库内置了一个gpio函数,该函数可以直接从终端访问GPIO,而无需编写任何代码。在终端中输入「gpio -h」可获取到gpio函数的应用说明:

5、大量实例参考: 

链接已隐藏,如需查看请登录或者注册

 


 

 

 

最新回复

wiringPi库内置了一个gpio函数,该函数可以直接从终端访问GPIO,而无需编写任何代码,感情也方便了吧,无需写任何代码   详情 回复 发表于 2023-11-15 07:45
点赞 关注
 
 

回复
举报

409

帖子

7

TA的资源

纯净的硅(初级)

沙发
 

还是树莓派好玩,这个是要做个什么作品啊

 
 
 

回复

6587

帖子

0

TA的资源

五彩晶圆(高级)

板凳
 

wiringPi库内置了一个gpio函数,该函数可以直接从终端访问GPIO,而无需编写任何代码,感情也方便了吧,无需写任何代码

 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表