C#中树莓派的CPU温度 [英] CPU temperature of Raspberry Pi in C#

查看:71
本文介绍了C#中树莓派的CPU温度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了很多关于这个主题的文章和论坛帖子,但几乎所有内容都非常复杂,而且都是 2 年多以前的内容.

I have read a lot of articles and forum posts about this topic, but almost everything is quite complicated and all from over 2+ years ago.

所以我想知道,在 C# 中获得 Raspberry Pi 的 CPU 温度的最佳方法是什么?

So I was wondering, What is the best way tot get the CPU temperature of the Raspberry Pi in C#?

我有最新版本的 Windows 10 IoT Core.

I have the newest version of Windows 10 IoT Core.

更新

我不想降低 CPU 温度.我正在使用 Sense HAT.那东西的温度传感器位于CPU附近,因此读数不准确.我找到了一个使读数准确的 python 脚本,但它需要 CPU 温度.

I dont want to reduce the CPU temperature. I am using the Sense HAT. The temperature sensor of that thing is located near the CPU so the reading is inaccurate. I have found a python script what makes the reading accurate, but it needs the CPU temperature.

注意:

我正在使用 Windows 10 IoT 核心版!我没有有这个文件:/sys/class/thermal/thermal_zone0/temp

I am using Windows 10 IoT Core! I DO NOT have this file: /sys/class/thermal/thermal_zone0/temp

更新 2:

如果唯一的方法是编写自己的驱动程序,请指导我如何做.我对编写驱动程序或任何如此低级的东西一无所知......

If the only way is to write your own driver, please guide me how to do that. I don't know anything about writing drivers or anything so low-level...

推荐答案

据我所知,目前还没有 IoT SDK 或 powershell 客户端可以访问低级 BCM2836 外设.您需要编写自己的驱动程序.您可以遵循 https://github.com/ms-iot 中的代码示例/bsp/tree/master/drivers,它是在 WDK 框架下编写的,因此您需要熟悉它才能开始使用.

As far as i know, there is no IoT SDK or powershell client could access to low-level BCM2836 peripherals.You need to write your own drivers. You can follow the code samples from https://github.com/ms-iot/bsp/tree/master/drivers, it's written under WDK framework so you'll need to get yourself familiar with that in order to get started.

另一种选择是使用 DS18B20 热传感器测量温度.该热传感器通过 I2C 连接树莓派.您需要在解决方案中通过 nuget 安装 Rinsen.OneWire 包,该库是用 C# 编写的,并且内置了对 DS18B20 和 DS18S20 传感器的支持.

Another option is, measure temperature using DS18B20 thermal sensors. This thermal sensor connects the raspberry pi via I2C. And you need to install Rinsen.OneWire package via nuget in your solution, this library is written in C# and it has built-in support for DS18B20 and DS18S20 sensors.

我不是 100% 确定这是正确的方法,但如果有人可以纠正我或指出更好的解决方案,我会非常乐意从中学习.

I'm not 100 percent sure this is the right way to go, but if someone could correct me or point out a better solution, I would be more than happy to learn from it.

这篇关于C#中树莓派的CPU温度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆