Send live bitmap to TV using arduino

:) Hello there everyone so i made this code on Java that takes a picture transforms it into a bitmap then into an array of Bits then basically sends it to the Arduino Pixel by pixel using Serial . then the arduino arranges the Serial transmitted data in real time and displays the BITMAP data on the screen . as i sed for the PC program i used Java and for the arduino NTSC rendering and signal management i used the lib arduino tvout .

here is a video : http://www.youtube.com/watch?v=Ddm7qSh8Es4

so thank you for taking the time to read this . is anyone finds this useful contact me on Facebook the link is under the video or PM me here i also made other projects that can be found on my channel (that no one checked yet XD) so thank you for taking the time to read this . is anyone finds this useful contact me on Facebook the link is under the video or PM me here :D

(deleted)

Sure there you go :
i had stored the RefreshXY function but i lost the main ino file :
so the refreshxy and the PC program (attached below) are tested to be working .
although the other function is one that i wrote 2day . i think its exactly like the old one .
(FOR the PC program make sure your Serial port is init before you run the Exe since the first thing the program
does is to check for the serial port . :slight_smile: if no serial port is detected it wont do anything to the selected file)
Enjoy bro

void disp_arr(){
int x,y; long int i = 0;
while (true){
while (!Serial.available()){}
byte c = Serial.read()-'0';
i++;
if(c != 0){refresh_xy(i,&x,&y); TV.set_pixel(x,y,1);}
if(c == 0){refresh_xy(i,&x,&y); TV.set_pixel(x,y,0);}
if(i == 126*96) break; //resolution limit
}
}
void refresh_xy(int count,int *x,int *y){
for(int i = 0;i<93;i++){
if(count%120 != 0) { if((count/120) == i) *y = i+1;}
else{if((count/120) == i) *y = i;}
}
*x = count - (120 * (*y-1));
}

Here is the processing Java code of the PC app : enjoy (i couldn’t upload the exe)

// THIS IS THE PROGRAM HERE




import java.io.BufferedReader;
import java.io.*;
import processing.serial.*;

Serial port;

PImage img,img2,img3;
public void setup()
{
stroke(255);
selectInput("Select a picture", "fileSelected");
port = new Serial(this,Serial.list()[0],9600);
port.bufferUntil('\n');
}








 


public void load_pixel_BW(float tr,float tg,float tb,PImage img){

 int dimension = img.width * img.height;
  img.loadPixels();
  for (int i = 0; i < dimension; i += 1) { 
      float r = red(img.pixels[i]);
      float g = green(img.pixels[i]);
      float b = blue(img.pixels[i]);
     if(((r+g+b)/3) > (127 - addity)) img.pixels[i] = color(255);
     if(((r+g+b)/3) < (127 + addity)) img.pixels[i] = color(0);
    }
  img.updatePixels();
}




public void load_pixel_white(float tr,float tg,float tb,PImage img){

 int dimension = img.width * img.height;
  img.loadPixels();
  for (int i = 0; i < dimension; i += 1) { 
      float r = red(img.pixels[i]);
      float g = green(img.pixels[i]);
      float b = blue(img.pixels[i]);
     if(((r+g+b)/3) >= addity) img.pixels[i] = color(255,255,255);
    }
  img.updatePixels();
}

public void load_pixel_green(float tr,float tg,float tb,PImage img){

 int dimension = img.width * img.height;
  img.loadPixels();
  for (int i = 0; i < dimension; i += 1) { 
      float r = red(img.pixels[i]);
      float g = green(img.pixels[i]);
      float b = blue(img.pixels[i]);
     if(g > ((r+b)/2)+addity) img.pixels[i] = color(255,255,255);
    }
  img.updatePixels();
}

int[] pix = new int[11160];

public void load_pixel_arr(PImage img){

 int dimension = img.width * img.height;
  img.loadPixels();
  for (int i = 0; i < dimension; i += 1) { 
    
      if(img.pixels[i] == color(255)) pix[i] = 1;
      if(img.pixels[i] == color(0)) pix[i] = 0;
    }
    System.out.println("pixel count mounted");
}

void int_array_serial(int arr[],int sps,int mrk){
//opening the port
for(int i = 0;i<100;i++){
port.write("Standby"); delay(10);
}

for(int i = 0;i<11159;i++){
port.write(arr[i]);  delay(5);
}
}


//px count     128*196 = 25088

void fileSelected(File selection) {
  if (selection == null) {} else {
   ss = selection.getAbsolutePath();
   pass = 1;
  }
}
String ss;
int pass = 0;
int addity = 0;
public void draw()
{
  while(pass == 0){}
  img = loadImage(ss);
  img.resize(120,93);
  load_pixel_BW(255,255,255,img);
  load_pixel_arr(img);
  int_array_serial(pix,2,3);
  image(img,0,0);
  return;



     
    }    
    

String written;


void serialEvent (Serial port)
{
written = port.readStringUntil('\n');
}