Processing 썸네일형 리스트형 Socket을 이용한 Python과 Processing 간의 통신 Processing client.pde import processing.net.*; Client myClient; void setup() { size(200, 200); myClient = new Client(this, "127.0.0.1", 3030); } void draw() { myClient.write("Hello"); // send whatever you need to send here String kk = myClient.readString(); println(kk); } Python server.py import socket HOST = '127.0.0.1' PORT = 3030 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((H.. Q-learning grid world 예제 코드 Processing을 이용해 q learning을 이용한 grid world 예제를 작성해보았다. QLearningAgent.pde import grafica.*; int cellSize = 50; Cell[][] grid; PVector goal; PVector agent; int gridSize = 15; int trainStep = 0; int moveStep = 0; boolean reset = true; PrintWriter output; int nPoints = 500; GPointsArray points = new GPointsArray(nPoints); GPlot plot; void setup() { size(1000, 700, P3D); grid = new Cell[gridSize][gr.. Processing에서 MIDI 연주 예제 Processing에서 MIDI 소리를 출력하기 위해 먼저 midibus 라이브러리를 설치한다. 1234567891011121314151617181920212223242526import themidibus.*; MidiBus bus;int velocity;int note; void setup(){ size(256, 256); background(0); MidiBus.list(); bus= new MidiBus(this, 0, 2);} void draw(){ } void mousePressed(){ note= mouseX; velocity= mouseY; bus.sendNoteOn(0, note, velocity);} void mouseReleased(){ bus.sendNoteOff(0, note, ve.. Processing에서 leap motion 사용하기 예제 Processing에서 leap motion을 테스트하는 예제를 만들어보자 일단 Processing에서 쓸 수 있게 library 설치가 필요한데, 사실 Processing이 아직 어떻게 돌아가는지 잘 몰라서, 인터넷에서 다운 받은 library를 어떻게 넣는지 잘 모르겠다 헤헤 친절하게도 Processing에 eclipse 처럼 library를 바로 받아 적용할 수 있는 기능이 있다. Sketch > Import library에서 leap을 검색하면 'Leap Motion for Processing' 이 나오는데, 해당 항목을 install 해주면 Processing에서 leap motion을 바로 사용할 수 있다. 정말 단순한 예제를 작성해보았다. import de.voidplus.leapmotion.. Ubuntu에 leap motion 설치하기 Leap motion을 사용하기 위해서 먼저 ubuntu에 설치를 진행해보자 https://www.leapmotion.com/setup/desktop/linux/ 공식 사이트에서 받은 package가 다음과 같은 에러가 발생하더라.https://askubuntu.com/questions/741304/getting-installation-error-on-working-package-when-using-apt여기 주소를 들어가면 에러 안나는 linux 버젼의 leap motion 설치 파일을 받을 수 있다.받은 파일을 더블 클릭하면 ubuntu software로 연결돼서 설치할 수 있는데, 또 에러가 발생할 수 있다!이 때는 system settings에서 software&update의 'download f.. 이전 1 다음