标签: raspberry-pi

npm无法安装node-hid(faild安装最新版本的Nodejs)

我正在尝试在我的Raspberry Pi(Raspbian)上安装node-hid.但是node-hid需要高版本的Nodej才能工作(> = 0.8)而我的版本只有0.6.19.

所以,我尝试用nvm安装Nodejs v0.10.26 ... Nvm成功安装了nodejs v0.10.26,但是npm仍然使用旧版本的Nodejs.如何在整个系统中使用v0.10.26版本的Nodej?我该如何安装node-hid?

谢谢您的帮助

这是我在尝试安装node-hid时得到的代码:

pi@raspberrypi ~ $ sudo npm install -g node-hid
npm http GET https://registry.npmjs.org/node-hid

npm ERR! Error: failed to fetch from registry: node-hid
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:209:10)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at ClientRequest.onError (/usr/lib/nodejs/request/tunnel.js:164:21)
npm ERR!     at ClientRequest.g …
Run Code Online (Sandbox Code Playgroud)

node.js npm raspberry-pi

1
推荐指数
1
解决办法
2470
查看次数

sqlite3从打印数据中删除括号

我创建了一个脚本,用于查找数据库第一行中的最后一个值

import sqlite3
global SerialNum
conn = sqlite3.connect("MyFirstDB.db")
conn.text_factory = str
c = conn.cursor()
SerialNum = c.execute('select Serial from BI4000 where Serial in (Select max(Serial) from BI4000)')
print SerialNum
conn.commtt()
conn.close()
Run Code Online (Sandbox Code Playgroud)

程序打印结果

[('00003',)]
Run Code Online (Sandbox Code Playgroud)

这是当前数据库中的最后一个结果,将输入到最终数据库的所有数据都将是序列号,因此它将按顺序排列.

我的问题是我可以删除所有引号/括号/逗号,因为我希望将此值设置为变量.

我希望制作的程序是一个向数据库添加新条目的测试系统,我希望检查数据库中的最后一个条目,以便系统可以从该点继续输入.

python database sqlite raspberry-pi

1
推荐指数
1
解决办法
4313
查看次数

必需参数'rejectLevels'(pos 2)未找到OpenCV Raspberry Pi

我有一个小脚本,我将图片从覆盆子pi上的picamera传递到OpenCV的流.一旦OpenCV有了图像,它应该使用haar级联方法寻找面部.如果我将面部检测分开,代码将运行正常,读入图像并按预期上传到远程服务器.当我进行面部检测时,我得到以下错误:

flags = cv2.cv.CV_HAAR_SCALE_IMAGE

TypeError:找不到必需参数'rejectLevels'(pos 2)

这是代码:

current_time = time.time()
endtime = current_time + 30

stream  = io.BytesIO()

CAMERA_WIDTH = 640
CAMERA_HEIGHT = 480

cascPath = sys.argv[1]
faceCascade = cv2.CascadeClassifier(cascPath)

while current_time <= endtime:
    timeStamp = time.strftime('%d-%m-%Y-%H-%M-%S', time.localtime(current_time))

    with picamera.PiCamera() as cam:
        cam.rotation = 270
        cam.resolution = (CAMERA_WIDTH, CAMERA_HEIGHT)
        cam.capture(stream, format='bmp')

    data = np.fromstring(stream.getvalue(), dtype=np.uint8)
    img = cv2.imdecode(data, 1)
    stream.seek(0)
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

    faces = faceCascade.detectMultiScale(
        gray,
        scaleFactor=1.1,
        minNeighbours=5,
        minSize=(30,30),
        flags = cv2.cv.CV_HAAR_SCALE_IMAGE
    )

    print("Found {0} faces!".format(len(faces)))
Run Code Online (Sandbox Code Playgroud)

我不确定错误告诉我的是什么,一些建议会很棒!

opencv python-2.7 raspberry-pi

1
推荐指数
1
解决办法
3592
查看次数

CockroachDB可以在Raspberry Pi上运行吗?

我有兴趣在一组PI上测试CockroachDB.任何人都知道,如果考虑到他们仍在阿尔法,这目前是否可行?

raspberry-pi cockroachdb

1
推荐指数
1
解决办法
374
查看次数

java.security.ProviderException:无法派生密钥

我正在尝试在我的Raspberry Pi 2上设置signal-cli(https://github.com/AsamK/signal-cli)。

我安装成功,但是当我尝试注册新的电话号码时,java抛出以下错误:

Error loading state file "/home/osmc/.config/signal/data/xxxxx": javax.net.ssl.SSLException: java.security.ProviderException: Could not derive key
Run Code Online (Sandbox Code Playgroud)

在网络上的任何地方都找不到任何解决方案。

java gradle raspberry-pi

1
推荐指数
1
解决办法
2745
查看次数

研究设备驱动程序源文件?

我想研究一些设备驱动程序的源文件,这些驱动程序是在raspberry pi(raspian),beaglebone(debian)或我的笔记本电脑(ubuntu)上安装和加载的.

我的目标是通过研究一些实际工作的驱动程序的源文件来学习如何正确实现我自己的模块.

我对与实际硬件(USB,I2C,SPI,UART等)通信的驱动程序特别感兴趣.

有人能告诉我如何找到这些来源吗?它们是否在某些特定文件夹中可用,例如/ usr/src/****或者我是否必须从特定内核版本下载所有内核源文件?

我们非常感谢所有建议,意见和建议.

ps我读过"Linux内核开发第3版"但请告诉我你是否知道关于这个主题的任何其他免费/开源书籍.

最好的问候Henrik

kernel linux-device-driver linux-kernel raspberry-pi beagleboneblack

1
推荐指数
1
解决办法
1139
查看次数

Raspberry makefile

我正在尝试将程序从我的cloud9-ide移动到我的覆盆子.但是当我移动它们时,makefile不再有效.

#
# Makefile
#
# Computer Science 50
# Problem Set 5
#


# compiler to use
CC = clang

# flags to pass compiler
CFLAGS = -ggdb3 -O0 -Qunused-arguments -std=c11 -Wall -Werror

# name for executable
EXE = myTest

# space-separated list of header files
HDRS = i2cContinuousRead.h

# space-separated list of libraries, if any,
# each of which should be prefixed with -l
LIBS =

# space-separated list of source files
SRCS = myTest.c i2cContinuousRead.c

# automatically …
Run Code Online (Sandbox Code Playgroud)

c makefile raspberry-pi

1
推荐指数
1
解决办法
164
查看次数

在Raspbery Pi上的Python程序中更改音量

我使用Raspbery Pi B +2。我有一个Python程序,该程序使用超声传感器测量到物体的距离。我想根据与人的距离改变音量。有一个Python代码来获取距离,我不知道如何通过Python中的代码更改Raspbery Pi的体积。

有什么办法吗?

python-2.7 raspberry-pi raspberry-pi2

1
推荐指数
1
解决办法
5771
查看次数

海湾合作委员会:与-O0的奇怪错误,没有没有

我想在没有优化的情况下编译我的C代码,但是当我在编译命令中添加-O0选项时,我得到了许多"多个定义"错误,我甚至没有写过函数!我想有一些显而易见的东西我在这里不见了,但作为一个菜鸟,我只是无法弄清楚是什么......

这是我的代码:

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <wiringPi.h>
#include <time.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <semaphore.h>
#include <unistd.h>
#include <sched.h>
#include <time.h>

#define N       1800

unsigned long int tsec, tnsec;

int main(void)
{
        int err, i;
        printf("started\n");

        struct timespec tps, tpe, req, rem;

        req.tv_nsec = 400000;
        req.tv_sec = 0;

        struct sched_param param;
        param.sched_priority = 99;
        err = sched_setscheduler(getpid(), SCHED_FIFO, &param);
        if (err != 0)
                printf("sched_setscheduler error");
        err = sched_getparam(getpid(), &param);
        if (err != 0)
                printf("sched_getparam error");
        printf("priority = …
Run Code Online (Sandbox Code Playgroud)

c gcc rtos compiler-optimization raspberry-pi

1
推荐指数
1
解决办法
111
查看次数

Python 3.6字符串输入

我正在使用Raspberry Pi 3并使用Python控制三个LED.我可以说我对Python很好.这是我的代码:

import RPi.GPIO as GPIO
import time

#GPIO Pins
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(17,GPIO.OUT)
GPIO.setup(27,GPIO.OUT)
GPIO.setup(22,GPIO.OUT)

def led(color,state):
    if state == "on":
        if color == "g": #green
            GPIO.output(27,GPIO.HIGH)
        elif color == "y": #yellow
            GPIO.output(22,GPIO.HIGH)
        elif color == "r": #red
            GPIO.output(17,GPIO.HIGH)
        print ("LED on")
    elif state == "off":
        if color == "g":
            GPIO.output(27,GPIO.LOW)
        elif color == "y":
            GPIO.output(22,GPIO.LOW)
        elif color == "r":
            GPIO.output(17,GPIO.LOW)
        print ("LED off")

while True:
    leds_col = input("Color (r, g, y): ")
    leds_stat = input("On or Off: ") …
Run Code Online (Sandbox Code Playgroud)

python python-3.x raspberry-pi raspberry-pi3

1
推荐指数
1
解决办法
322
查看次数