1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Arduino と Processing 連携

Posted at

Arduinodで信号が送られた際に、Processing上で映像を変化させるためのメモ。
後々、MaxかTouchDesignerで映像を数値で切り替えられればいいな。

 参考 シリアル通信でArduinoからProcessingに情報を渡す
http://tsukutta.hatenablog.com/entry/2013/06/27/190219


なぜか、シリアル通信できない。
なんで?


できた。
firamataつかえばいい。
※setup をsetuo って書いてた。

//processim firmate test

import processing.serial.*;
import cc.arduino.*;
import org.firmata.*;

final int sP = 0;
final int lp = 9;

Arduino arduino;

void setup(){
 size(400,400);
 arduino = new Arduino(this, "/dev/tty.usbmodem1411", 57600);
 arduino.pinMode(lp, Arduino.OUTPUT);
}

void draw(){
 // int sV = arduino.analogRead(sP);
  int sV = arduino.analogRead(sP);
  int b =  round(map(sV, 0 , 1023, 0, 255));
  background(b);
  arduino.analogWrite(lp, b);
}

arduino側では、firmataのサンプルのstandardFiramataを使えばいい。

1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?