Drkcore

07 10 2008 電子工作 Gainer processing Tweet

Gainerでピンポン玉ディフューザー

とりあえずprocessingでいじる。マウスの位置に応じて色が変化するように。

コードは単純なので色もあんまり出なかった。

import processing.gainer.*;

Gainer gainer;
void setup(){
  gainer = new Gainer(this);
}

void draw(){
  background(0);
}

void mouseMoved(){

  float rx = (float)mouseX / width;
  float ry = (float)mouseY / height;
  int v0 = int(255*ry);
  int v1 = int(255*rx);

  gainer.analogOutput(0, v0);
  gainer.analogOutput(1, max(v1-v0,0));
  gainer.analogOutput(3, max(v0-v1,0));
}

参考

  • ピンポン玉をLEDのディフューザーに
  • コード例4(アナログ出力):aOut

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021