버퍼 넘침으로 데이터가 손상되었습니다.

19044 단어 voodoospark

묘사

https://github.com/voodootikigod/voodoospark/blob/master/firmware/voodoospark.cpp#L731
(적절한 이름) 그룹 buffer 에 버퍼 넘침이 있습니다.available 가 16 (그룹의 크기) 보다 크면, 읽는 추가 바이트는 그룹 밖으로 기록됩니다.bytesRead 변수가 읽는 총 바이트 수를 추적할 때 (16개를 초과하더라도) buffer 수조 이외의 바이트는 cached 수조에 분배되고 넘치는 데이터는 다시 작성됩니다.
이 디버그 추적은 완벽한 예를 보여 준다.프로세스 Input 호출 후 버퍼의 마지막 3 바이트를 주의하십시오.버퍼가 이동할 때 데이터가 파괴됩니다.
--------------CONNECTED--------------
--------------PROCESSING NEW DATA--------------
----------processInput----------
Bytes Available: 18
0: 0
1: 4
2: 1
3: 0
4: 10
5: 1
6: 0
7: 2
8: 1
9: 1
10: 5
11: 0
12: 1
13: 4
14: 1
15: 2
16: 10
17: 100
Bytes Expecting: 3
Bytes Read: 18
Action received: 0
Cached: 00
Cached: 14
Cached: 21
PIN received: 255
MODE received: 1
# Unprocessed Bytes: 15
----------processInput----------
Bytes Available: 15
0: 0
1: 10
2: 1
3: 0
4: 2
5: 1
6: 1
7: 5
8: 0
9: 1
10: 4
11: 1
12: 2
13: 0
14: 4
Bytes Expecting: 3
Bytes Read: 15
Action received: 0
Cached: 00
Cached: 110
Cached: 21
PIN received: 10
MODE received: 1
# Unprocessed Bytes: 12
....

해결책은 이 선을 따라 순환하는 것으로 바꾸는 것이다.
 for (int i = 0; i < available && i < 16 ; i++) {
        buffer[i] = client.read();
        bytesRead++;
      }

토론 #1

야!이것은 수신 동작의 일부 바이트라는 또 다른 문제를 가져왔다.사용하지 않은 바이트가 loop 다음 교체에 덮어쓰이기 때문에 다음 명령이 잘못 읽혔습니다.
이 지점은 이 두 가지에 대해 모두 복원되었다.
https://github.com/notthetup/voodoospark/commit/010c717e6e0744f63204841e9811dd2ace5f57b3
테스트/구축 절차를 실행해야 합니까?그렇지 않으면 나는 PR

토론 #2

을 제기할 수 있다. 지금 PR을 제기할 수 있다. 나는 그것을 위해 테스트를 설계할 것이다.
크리스 윌리엄스
무독신http://twitter.com/voodootikigod| GitHub
http://github.com/voodootikigod
내가 만든 물건을 너는 반드시 보아야 한다.
안전했어http://www.saferaging.com/| JSConfhttp://jsconf.com/|
기계인http://robotsconf.com/|로봇 스위클리
http://robotsweekly.com/
인터넷의 소극적인 감정을 끝내고 공유해 주세요.
http://jsconf.eu/2011/an_end_to_negativity.html.
2014년 11월 16일 일요일 오전 11:06,Chinmay Pendharkar [email protected]:

Ah! That lead me to another issue of receiving part of the bytes of an action. The unused bytes are overwritten in the next iteration of the loop .

This branch has fixes for both.

notthetup@010c717 https://github.com/notthetup/voodoospark/commit/010c717e6e0744f63204841e9811dd2ace5f57b3

Are there any tests/build steps I need to run? Else I can raise a PR.

— Reply to this email directly or view it on GitHub https://github.com/voodootikigod/voodoospark/issues/33#issuecomment-63224795 .

토론 #셋

#30과 관련된

토론 #4

복제 절차를 보고 싶은데요?그리고https://github.com/rwaldron/spark-io/issues/30?우리는 명령이 너무 빨리 발송되었기 때문에 결론을 얻었다.여기에 기술된 버퍼 넘침이 좋은 선택인 것 같습니다.

토론 #5

모든 8개의 디지털 파이프라인에 대해 파이프라인 모드 명령을 보내고 8개의 디지털 파이프라인에 대해 중복된 숫자 쓰기를 통해 복사할 수 있다.패치와 새 버전

토론 #6

@reseguie에서 이것을 무시한 것 같습니다.

토론 #7

출력:
--------------RESTORING
--------------CONNECTED
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 3
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 0
PIN: 0
MODE: 1
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 21
--------------PROCESSING
Bytes Read: 21
Bytes Using: 3
ACTION: 0
PIN: 1
MODE: 1
--------------PROCESSING
Bytes Read: 18
Bytes Using: 3
ACTION: 0
PIN: 2
MODE: 1
--------------PROCESSING
Bytes Read: 15
Bytes Using: 3
ACTION: 0
PIN: 3
MODE: 1
--------------PROCESSING
Bytes Read: 12
Bytes Using: 3
ACTION: 0
PIN: 4
MODE: 1
--------------PROCESSING
Bytes Read: 9
Bytes Using: 3
ACTION: 0
PIN: 5
MODE: 1
--------------PROCESSING
Bytes Read: 6
Bytes Using: 3
ACTION: 0
PIN: 6
MODE: 1
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 0
PIN: 7
MODE: 1
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 3
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 0
VALUE: 1
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 21
--------------PROCESSING
Bytes Read: 21
Bytes Using: 3
ACTION: 1
PIN: 1
VALUE: 1
--------------PROCESSING
Bytes Read: 18
Bytes Using: 3
ACTION: 1
PIN: 2
VALUE: 1
--------------PROCESSING
Bytes Read: 15
Bytes Using: 3
ACTION: 1
PIN: 3
VALUE: 1
--------------PROCESSING
Bytes Read: 12
Bytes Using: 3
ACTION: 1
PIN: 4
VALUE: 1
--------------PROCESSING
Bytes Read: 9
Bytes Using: 3
ACTION: 1
PIN: 5
VALUE: 1
--------------PROCESSING
Bytes Read: 6
Bytes Using: 3
ACTION: 1
PIN: 6
VALUE: 1
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 7
VALUE: 1
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 3
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 0
VALUE: 0
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 21
--------------PROCESSING
Bytes Read: 21
Bytes Using: 3
ACTION: 1
PIN: 1
VALUE: 0
--------------PROCESSING
Bytes Read: 18
Bytes Using: 3
ACTION: 1
PIN: 2
VALUE: 0
--------------PROCESSING
Bytes Read: 15
Bytes Using: 3
ACTION: 1
PIN: 3
VALUE: 0
--------------PROCESSING
Bytes Read: 12
Bytes Using: 3
ACTION: 1
PIN: 4
VALUE: 0
--------------PROCESSING
Bytes Read: 9
Bytes Using: 3
ACTION: 1
PIN: 5
VALUE: 0
--------------PROCESSING
Bytes Read: 6
Bytes Using: 3
ACTION: 1
PIN: 6
VALUE: 0
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 7
VALUE: 0
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 3
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 0
VALUE: 1
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 21
--------------PROCESSING
Bytes Read: 21
Bytes Using: 3
ACTION: 1
PIN: 1
VALUE: 1
--------------PROCESSING
Bytes Read: 18
Bytes Using: 3
ACTION: 1
PIN: 2
VALUE: 1
--------------PROCESSING
Bytes Read: 15
Bytes Using: 3
ACTION: 1
PIN: 3
VALUE: 1
--------------PROCESSING
Bytes Read: 12
Bytes Using: 3
ACTION: 1
PIN: 4
VALUE: 1
--------------PROCESSING
Bytes Read: 9
Bytes Using: 3
ACTION: 1
PIN: 5
VALUE: 1
--------------PROCESSING
Bytes Read: 6
Bytes Using: 3
ACTION: 1
PIN: 6
VALUE: 1
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 7
VALUE: 1
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 3
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 0
VALUE: 0
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 21
--------------PROCESSING
Bytes Read: 21
Bytes Using: 3
ACTION: 1
PIN: 1
VALUE: 0
--------------PROCESSING
Bytes Read: 18
Bytes Using: 3
ACTION: 1
PIN: 2
VALUE: 0
--------------PROCESSING
Bytes Read: 15
Bytes Using: 3
ACTION: 1
PIN: 3
VALUE: 0
--------------PROCESSING
Bytes Read: 12
Bytes Using: 3
ACTION: 1
PIN: 4
VALUE: 0
--------------PROCESSING
Bytes Read: 9
Bytes Using: 3
ACTION: 1
PIN: 5
VALUE: 0
--------------PROCESSING
Bytes Read: 6
Bytes Using: 3
ACTION: 1
PIN: 6
VALUE: 0
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 7
VALUE: 0
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 3
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 0
VALUE: 1
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 21
--------------PROCESSING
Bytes Read: 21
Bytes Using: 3
ACTION: 1
PIN: 1
VALUE: 1
--------------PROCESSING
Bytes Read: 18
Bytes Using: 3
ACTION: 1
PIN: 2
VALUE: 1
--------------PROCESSING
Bytes Read: 15
Bytes Using: 3
ACTION: 1
PIN: 3
VALUE: 1
--------------PROCESSING
Bytes Read: 12
Bytes Using: 3
ACTION: 1
PIN: 4
VALUE: 1
--------------PROCESSING
Bytes Read: 9
Bytes Using: 3
ACTION: 1
PIN: 5
VALUE: 1
--------------PROCESSING
Bytes Read: 6
Bytes Using: 3
ACTION: 1
PIN: 6
VALUE: 1
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 7
VALUE: 1
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 3
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 0
VALUE: 0
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 21
--------------PROCESSING
Bytes Read: 21
Bytes Using: 3
ACTION: 1
PIN: 1
VALUE: 0
--------------PROCESSING
Bytes Read: 18
Bytes Using: 3
ACTION: 1
PIN: 2
VALUE: 0
--------------PROCESSING
Bytes Read: 15
Bytes Using: 3
ACTION: 1
PIN: 3
VALUE: 0
--------------PROCESSING
Bytes Read: 12
Bytes Using: 3
ACTION: 1
PIN: 4
VALUE: 0
--------------PROCESSING
Bytes Read: 9
Bytes Using: 3
ACTION: 1
PIN: 5
VALUE: 0
--------------PROCESSING
Bytes Read: 6
Bytes Using: 3
ACTION: 1
PIN: 6
VALUE: 0
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 7
VALUE: 0
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 3
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 0
VALUE: 1
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 21
--------------PROCESSING
Bytes Read: 21
Bytes Using: 3
ACTION: 1
PIN: 1
VALUE: 1
--------------PROCESSING
Bytes Read: 18
Bytes Using: 3
ACTION: 1
PIN: 2
VALUE: 1
--------------PROCESSING
Bytes Read: 15
Bytes Using: 3
ACTION: 1
PIN: 3
VALUE: 1
--------------PROCESSING
Bytes Read: 12
Bytes Using: 3
ACTION: 1
PIN: 4
VALUE: 1
--------------PROCESSING
Bytes Read: 9
Bytes Using: 3
ACTION: 1
PIN: 5
VALUE: 1
--------------PROCESSING
Bytes Read: 6
Bytes Using: 3
ACTION: 1
PIN: 6
VALUE: 1
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 7
VALUE: 1
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 3
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 0
VALUE: 0
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 21
--------------PROCESSING
Bytes Read: 21
Bytes Using: 3
ACTION: 1
PIN: 1
VALUE: 0
--------------PROCESSING
Bytes Read: 18
Bytes Using: 3
ACTION: 1
PIN: 2
VALUE: 0
--------------PROCESSING
Bytes Read: 15
Bytes Using: 3
ACTION: 1
PIN: 3
VALUE: 0
--------------PROCESSING
Bytes Read: 12
Bytes Using: 3
ACTION: 1
PIN: 4
VALUE: 0
--------------PROCESSING
Bytes Read: 9
Bytes Using: 3
ACTION: 1
PIN: 5
VALUE: 0
--------------PROCESSING
Bytes Read: 6
Bytes Using: 3
ACTION: 1
PIN: 6
VALUE: 0
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 7
VALUE: 0
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 3
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 0
VALUE: 1
--------------BUFFERING AVAILABLE BYTES
BUFFERED: 21
--------------PROCESSING
Bytes Read: 21
Bytes Using: 3
ACTION: 1
PIN: 1
VALUE: 1
--------------PROCESSING
Bytes Read: 18
Bytes Using: 3
ACTION: 1
PIN: 2
VALUE: 1
--------------PROCESSING
Bytes Read: 15
Bytes Using: 3
ACTION: 1
PIN: 3
VALUE: 1
--------------PROCESSING
Bytes Read: 12
Bytes Using: 3
ACTION: 1
PIN: 4
VALUE: 1
--------------PROCESSING
Bytes Read: 9
Bytes Using: 3
ACTION: 1
PIN: 5
VALUE: 1
--------------PROCESSING
Bytes Read: 6
Bytes Using: 3
ACTION: 1
PIN: 6
VALUE: 1
--------------PROCESSING
Bytes Read: 3
Bytes Using: 3
ACTION: 1
PIN: 7
VALUE: 1

토론 #8

따라서 위의 디버깅 추적(최초 게시물에서)은 이 JS 코드를 겨냥한 것이다.
var Spark = require("spark-io");

var io = new Spark({
    token: env.TOKEN,
    deviceId: env.DEVICE
});


io.on("ready", function(){
    console.log("CONNECTED");

    io.pinMode("D5", io.MODES.OUTPUT);
    io.pinMode("D4", io.MODES.OUTPUT);
    io.pinMode("A0", io.MODES.OUTPUT);

    io.pinMode("D3", io.MODES.OUTPUT);
    io.pinMode("D2", io.MODES.OUTPUT);
    io.pinMode("A4", io.MODES.OUTPUT);

    io.digitalWrite("D5", 0);
    io.digitalWrite("D4", 1);
    io.analogWrite("A0", 0);

    console.log("done right");

    io.digitalWrite("D3", 0);
    io.digitalWrite("D2", 1);
    io.analogWrite("A4", 0);

    console.log("done left");

});

토론 #9

착륙https://github.com/voodootikigod/voodoospark/commit/010c717e6e0744f63204841e9811dd2ace5f57b3
감사합니다!!

토론 #10

이것은 내가 테스트에서 사용한 것이다.
var Spark = require("../lib/spark");
var board = new Spark({
  token: process.env.SPARK_TOKEN,
  deviceId: process.env.SPARK_DEVICE_BLACK
});

board.on("ready", function() {
  console.log("CONNECTED");

  var byte = 0;

  for (var i = 0; i < 8; i++) {
    this.pinMode("D" + i, this.MODES.OUTPUT);
  }

  setInterval(function() {
    byte ^= 1;

    for (var i = 0; i < 8; i++) {
      this.digitalWrite("D" + i, byte);
    }
  }.bind(this), 1000);
});
var Spark = require("../lib/spark");
var board = new Spark({
  token: process.env.SPARK_TOKEN,
  deviceId: process.env.SPARK_DEVICE_BLACK
});

board.on("ready", function() {
  console.log("CONNECTED");

  var byte = 0;

  // (8 * 3) * 4
  for (var i = 0; i < 8; i++) {
    this.pinMode("D" + i, this.MODES.OUTPUT);
    this.pinMode("D" + i, this.MODES.OUTPUT);
    this.pinMode("D" + i, this.MODES.OUTPUT);
  }

  setInterval(function() {
    byte ^= 1;

    for (var i = 0; i < 8; i++) {
      this.digitalWrite("D" + i, byte);
      this.digitalWrite("D" + i, byte);
      this.digitalWrite("D" + i, byte);            
    }
  }.bind(this), 1000);
});

토론 #11

저는 이 다른 문제들을 되돌려주고 업데이트를 사용하여 다시 테스트할 것입니다.

토론 #12

@rwaldron@reseguie 네 말이 맞다. 명령을 바로 보낼 것이다.JF의 2개의 Motor-3 인스턴스를 동시에 제어하려고 할 때 처음 겪는 일입니다.이 문제는 내가 비슷한 일을 할 때 발생한 것이다.
...
function (){
leftMotor.fwd(100);
rightMotor.fwd(100);
}
왼쪽 모터에 대한 지령은 통과되었지만, 오른쪽 모터에 대한 지령은 통과되지 않았다.이것이 바로 내가 이 문제를 추적한 이유다.

토론 #13

대박!감사합니다!오늘 저녁 늦게 나는 퇴근 후에 다시 스님을 시험볼 것이다.

토론 #14

@notthetup 다시 한 번 감사 보고서

토론 #15

복원 #30과https://github.com/rwaldron/spark-io/issues/30! 위대한 발견 @ notthetup.

토론 #16

이거 정말 최고예요. @reseguie

토론 #17

테스트에 따라와주셔서 감사합니다.완벽무결!

토론 #18

@notthetup 이 복구가 얼마나 중요한지 알려줄 수는 없지만, 내가 얼마나 고마운지 알아줬으면 좋겠어요.미래의 공헌을 기대합니다:

토론 #19

@rwaldron은 문제가 아닙니다.몇 년 후, C++ 코드를 깊이 연구하는 것은 매우 재미있다.혀를 내밀어라:

토론 #20

@rwaldron 업데이트 후, Ctrl-C'ing이 간단한 프로그램을 종료할 때, 무슨 일이 일어날 것 같습니까?
var five = require('johnny-five');
var Spark = require('spark-io');
var board = new five.Board({
  io: new Spark({
    token: process.env.SPARK_TOKEN,
    deviceId: process.env.SPARK_DEVICE_ID
  })
});

board.on('ready', function() {
  var led = new five.Led.RGB(["A5", "A6", "A7"]);
  led.pulse(100);
});
내 예에서, 그것은 한동안 펄스를 계속할 것이다. 아마도 버퍼가 계속 비어 있을 때일 것이다.
그러나 리셋할 때 버퍼를 즉시 지워야 합니까?

토론 #21

@reseguie는 확실하지 않습니다. 존니 5번은 방송이 끝날 때 전화를 한 적이 없습니다reset.

토론 #22

@rwaldron 네, 저도 확실하지 않습니다.그냥 던져놓고 얘기 좀 하자.
최종 사용자로서 나는 매우 재미있다고 생각한다. 왜냐하면 나는 노드를 탈퇴할 때 펄스가 멈추기를 원하기 때문이다.js 프로그램은 서보가 이동을 멈추는 것과 같다. 단지 다른 사람들이 '예상' 하는 행동이 무엇인지 궁금할 뿐이다.

토론 #23

(내가 업데이트한 후에 지금 서보의 예를 시도해서 그것이 정말 예전처럼 멈췄는지 확인해야 한다고 생각한다.)

토론 #24

나는 이 점을 테스트할 수 없지만, 나는 무엇이 그것을 초래했는지 알고, 어떻게 그것을 피해야 할지 모르겠다.processInputloop가 계속되기 전에 전체 버퍼를 처리할 것이다.따라서 프로그램이 이 과정에서 연결을 끊으면 다음 순환에 이르러서야 펌웨어가 알 수 있다.

토론 #25

이 문제를 해결하는 방법은 다음과 같은 두 가지가 있다.
1. 어떤 중단 제어를 사용하여 중지processInput.Spark 가 이를 지원하는지 여부/어떻게 지원하는지 알 수 없습니다.
2. 다른 방법은 귀속 호출processInput 전에 연결이 여전히 유효한지 확인하는 것이다.https://github.com/voodootikigod/voodoospark/blob/master/firmware/voodoospark.cpp#L666

토론 #26

@notthetup 나는 2를 기점으로 하는 것을 좋아한다. 너는 그것을 조합할 수 있니?

토론 #27

@rwaldron 다음 주에 뭘 해도 돼요.20분 후에 JSconfAsia에서 노드 테스트를 시작합니다.
node-boats-prep

토론 #28

네.현재 연결을 끊을 때 초기화하는 문제를 연구하고 있습니다.여기 변화가 있어요.https://github.com/notthetup/voodoospark/commit/d1b06d2de267170ac6c7884fc7eaba3d1ac2734c
제가 뭘 테스트해도 돼요?servo.sweep()led.blink() 모두 그렇게 많은 명령을 보내지 않을 것이다.그것들은 100밀리초마다 명령을 보내기 때문에 버퍼에 몇 개의 명령만 있을 수 있다.
사상

토론 #29

@notthetup 이것은 나를 위한 것이다.
var five = require('johnny-five');
var Spark = require('spark-io');
var board = new five.Board({
  io: new Spark({
    token: process.env.SPARK_TOKEN,
    deviceId: process.env.SPARK_DEVICE_ID
  })
});

board.on('ready', function() {
  var led = new five.Led("A0");
  led.pulse(100);
});
몇 초 동안 실행하고 Ctrl-C 키를 누르면 계속 움직입니다.
나는 네가 바뀌기 전에 다시 한 번 시도할 것이다.그렇게 지도 모른다, 아마, 아마...내가 발표한'복제'라는 원시 예는 심지어 작용하지 않는다.(led.RGB의 led.pulse가 더 이상 없습니다.)표준 Led로는 안정적으로 복제할 수 없습니다.만약 내가 어딘가에서 그것을 다시 보게 된다면, 아마도 우리는 나와 함께 새로운 문제를 열 수 있을 것이다.

토론 #30

그러나 상술한 내용을 시험해 보았을 때, 나는 우리의 버퍼 해결 방안이 예상치 못한 결과를 초래할 수 있다는 것을 발견했다.
예를 들어, Led를 만들려고 하면RGB.번개 (), 때로는 예상치 못한 색깔로 변할 수도 있다.예를 들어 깜박거릴 때, 번갈아 하얗게 변하는 것이 아니라 정기적으로 빨간색으로 변한다.빨간색 값을 설정한 후에 G&B 설정을 하기 전에 버퍼링 한계에 도달했나요?
나는 어떻게 해야 할지 모르겠다. 지금은 단지 하나의 관찰일 뿐이다.
var five = require("johnny-five");
var Spark = require("spark-io");
var board = new five.Board({
  io: new Spark({
    token: process.env.SPARK_TOKEN,
    deviceId: process.env.SPARK_DEVICE_ID
  })
});

board.on("ready", function() {
  console.log("connected");
  var led = new five.Led.RGB(["A5", "A6", "A7"]);
  led.strobe(500);
});
데모:http://instagram.com/p/v2P1_8kJD9/

토론 #31

디버깅 로그가 있습니까?이것은 마땅히 우리에게 단서를 하나 주어야 한다.나는 또 일을 하고 있기 때문에, 나는 스파크 코어를 가지고 와서 이것을 테스트하지 않았다.

토론 #32

@reseguie 영상에 나오는 색깔이 정말 모르겠어요. 다 흰색으로 보여요.\

토론 #33

@rwaldron 미안해요. 제 핸드폰에서 색깔을 포착하는 게 귀찮아요.몇 번의 흰색 주파수가 번쩍이기 전에, 그것은 잠시 빨간색으로 반짝이지만, 여섯 번째 반짝일 때, 빨간색으로 변하고, 흰색으로 반짝이는 것을 볼 수 있다. (입력이 따라잡을 때) 그리고 계속할 것이다.
@ 아니오, 실행 중인 디버그 로그를 포착하지 않았습니다.나는 3일 동안 해킹 경기에 참가한 후에 저녁에 이 일을 했기 때문에 나의 뇌가 맞았다.나는 그것을 잡으려고 생각하지 못했다.다시 해볼게요.

토론 #34

apologies, capturing color on my phone was troublesome.


사과 안 해도 어떻게 해결해야 할지 모르겠어요.https://gitter.im/rwaldron/johnny-five:

@Resseguie I just changed send() to use a server.write(uint8_t *buffer, size_t size) instead of having 4 different server.write(uint8_t) calls and it seems like improvement. I'm not going to pursue the reporting-refactor branch at this time


금방 준비할게요

토론 #35

I'm not going to pursue the reporting-refactor branch at this time


이거 취소할게요...나는 방금 재구성을 다시 첨가해서 지금까지 가장 좋은 결과를 얻었다

좋은 웹페이지 즐겨찾기