commit 26513ceb656b94e3e001b233141508382735125d Author: brice Date: Wed Dec 10 13:25:49 2014 +0100 import diff --git a/README.md b/README.md new file mode 100644 index 0000000..4261688 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +Webcam2minitel by tetalab : + +www.tetalab.org diff --git a/minitel_software_serial_cam_final.pde b/minitel_software_serial_cam_final.pde new file mode 100644 index 0000000..e68f22e --- /dev/null +++ b/minitel_software_serial_cam_final.pde @@ -0,0 +1,32 @@ +#include +NewSoftSerial mySerial(6, 7); + +void setup() { + + Serial.begin(1200); // port serie vers le PC + mySerial.begin(1200); // port serie vers le minitel + mySerial.print(12,BYTE); //efface l'écran + serialprint7(0x0E); // passe en mode graphique +} + +void serialprint7(byte b) // permet d'ecrire en 7 bits + parité sur le software serial +{ + boolean i = false; + for(int j = 0; j<8;j++) + { + if (bitRead(b,j)==1) i =!i; //calcul de la parité + } + if (i) bitWrite(b,7,1); //ecriture de la partié + else bitWrite(b,7,0);//ecriture de la partié + mySerial.print(b);//ecriture du byte sur le software serial +} + +void loop() //tout ce que je recois sur le port serie, je le renvoi sur le software serial +{ + byte b =255; + while (b == 255) + { + b = Serial.read(); + } + serialprint7(b); +} diff --git a/video2minitelteletPerso_goodV4_3.pde b/video2minitelteletPerso_goodV4_3.pde new file mode 100644 index 0000000..fe86253 --- /dev/null +++ b/video2minitelteletPerso_goodV4_3.pde @@ -0,0 +1,163 @@ +//Video2Minitel +//by Renaud, Fabrice & Phil +//Inspired from Video2ledwallHarpSerial V1.0 by Fabrice Fourc +// http://www.tetalab.org + + +import processing.video.*; +import processing.net.*; +int plage=44;//256; +int MINITEL_CHAR_WIDTH = 40;//*2; +int MINITEL_CHAR_HEIGHT = 24;//*4; + // en fait ce n'est pas vraiment un pixel par pixel char... +int PIXEL_CHAR_WIDTH = 2; +int PIXEL_CHAR_HEIGHT = 3; + +// Size of each cell in the grid, ratio of window size to video size +int videoScale = 10; +int videoScalex = 8; +int videoScaley = 6; + + + +// Number of columns and rows in our system +int cols, rows; +// Variable to hold onto Capture object +public int s = 50; +import processing.serial.*; + +// The serial port: +Serial myPort; + +//luminosite globale de la colone pour le son +int colValue; +String ledCol; +String ledWallMsg; + +//Client myClient; +Capture video; + + + + +void setup() +{ + size(MINITEL_CHAR_WIDTH*PIXEL_CHAR_WIDTH*videoScalex,MINITEL_CHAR_HEIGHT*PIXEL_CHAR_HEIGHT*videoScaley); + frameRate(25); + + // List all the available serial ports: + println(Serial.list()); + + // I know that the first port in the serial list on my mac + // is always my Keyspan adaptor, so I open Serial.list()[0]. + // Open whatever port is the one you're using. + myPort = new Serial(this, Serial.list()[1], 1200); + + //myClient = new Client(this, "127.0.0.1", 5204); + // Initialize columns and rows + cols = width/videoScalex; + rows = height/videoScaley; + video = new Capture(this,cols,rows,30); +} + + +//---------------------------------------------------------- + +void displayPixelChar2(int x, int y) +{ + x= x *2; + y = y * 3; + byte carac=0; // caractère pixel + carac+=(Math.pow(2,0))*getG2(x+0,y+0); + carac+=(Math.pow(2,1))*getG2(x+1,y+0); + carac+=(Math.pow(2,2))*getG2(x+0,y+1); + carac+=(Math.pow(2,3))*getG2(x+1,y+1); + carac+=(Math.pow(2,4))*getG2(x+0,y+2); + carac+=(Math.pow(2,5))*1; + carac+=(Math.pow(2,6))*getG2(x+1,y+2); + myPort.write(carac); + println("carac= "+carac); +} + +int getG2(int x,int y) +{ + println("x + y*video.width" + (x + y*video.width)); + color c = video.pixels[x + y*video.width]; + int value = (int)brightness(c); // get the brightness + if (value