「デザイン03-1」の編集履歴(バックアップ)一覧はこちら

デザイン03-1」(2009/01/09 (金) 16:52:29) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

*オシロスコープ Gainerでanalog入力したときに、値を視覚的に確認したくなる。 そんなときにはコレ! #image(proce55.gif) (=゚ω゚)ノ\オシロスコ~プ/ &bold(){使うもの:}Processing、Gainer、何らかの回路 ---- ・作り方 (1) 入力値が知りたい、何らかの回路を用意する。 (2) Gainerと回路をつなぎ、GainerとPCをつなぐ。 (3) Processingに、以下のスクリプトを書き込む。 #highlight(c){{import processing.gainer.*; Gainer gainer; PFont myFont; int[] xvals; int[] bvals; int s1 = 0; int s2 = 0; void setup() { gainer = new Gainer(this); size(200, 200); xvals = new int[width]; bvals = new int[width]; myFont = loadFont("Eureka90.vlw"); textFont(myFont, 12); } int arrayindex = 0; void draw() { background(102); String analog0 = "analog[0] " + gainer.analogInput[0]; text(analog0, 15, 30); gainer.peekAnalogInput(); for(int i=1; i<width; i++) { xvals[i-1] = xvals[i]; bvals[i-1] = bvals[i]; } xvals[width-1] = 255-gainer.analogInput[0]; s1 = second(); if(s1 != s2) { bvals[width-1] = 90; } else { bvals[width-1] = 100; } s2 = second(); fill(255); noStroke(); //四角(左上の座標x, y, 縦の長さ, 横); rect(0, height/6, width, (height/6)*4); for(int i=1; i<width; i++) { stroke(200); point(i,height/3); stroke(200); point(i,(height/6)*4); stroke(200); point(i,height/2); stroke(0); point(i, height/3+xvals[i]/3); stroke(0); line(i, 2*height/3+bvals[i]/3, i, (2*height/3+bvals[i-1]/3)); } } }} ---- ---- today: &counter(today) yesterday: &counter(yesterday)
*Gainerオシロスコープ Gainerでanalog入力したときに、値を視覚的に確認したくなる。 そんなときにはコレ! #image(proce55.gif) (=゚ω゚)ノ\オシロスコ~プ/ &bold(){使うもの:}Processing、Gainer、何らかの回路 ---- ・作り方 (1) 入力値が知りたい、何らかの回路を用意する。 (2) Gainerと回路をつなぎ、GainerとPCをつなぐ。 (3) Processingに、以下のスクリプトを書き込む。 #highlight(c){{import processing.gainer.*; Gainer gainer; PFont myFont; int[] xvals; int[] bvals; int s1 = 0; int s2 = 0; void setup() { gainer = new Gainer(this); size(200, 200); xvals = new int[width]; bvals = new int[width]; myFont = loadFont("Eureka90.vlw"); textFont(myFont, 12); } int arrayindex = 0; void draw() { background(102); String analog0 = "analog[0] " + gainer.analogInput[0]; text(analog0, 15, 30); gainer.peekAnalogInput(); for(int i=1; i<width; i++) { xvals[i-1] = xvals[i]; bvals[i-1] = bvals[i]; } xvals[width-1] = 255-gainer.analogInput[0]; s1 = second(); if(s1 != s2) { bvals[width-1] = 90; } else { bvals[width-1] = 100; } s2 = second(); fill(255); noStroke(); //四角(左上の座標x, y, 縦の長さ, 横); rect(0, height/6, width, (height/6)*4); for(int i=1; i<width; i++) { stroke(200); point(i,height/3); stroke(200); point(i,(height/6)*4); stroke(200); point(i,height/2); stroke(0); point(i, height/3+xvals[i]/3); stroke(0); line(i, 2*height/3+bvals[i]/3, i, (2*height/3+bvals[i-1]/3)); } } }} ---- ---- today: &counter(today) yesterday: &counter(yesterday)

表示オプション

横に並べて表示:
変化行の前後のみ表示: