Processing3 with Oled Live Typing

During my second round of the Arrowdot’s lesson, we went to a very advanced code using Process3 and a library call Control P5.  This is an example of how

we use the Processing 3 and Control P5 library. We have an Oled, Arduino MEGA, and a computer to program. So what the process does is it runs and get all of the value from the keyboards and print those to the screen on the oled. I found that it was medium easy to write the code, what the code did is to get all of the numbers and texts but not the special characters like Shift, Ctrl and more. So when the user clicks Ctrl, it would clear all of the text that the user type. I get really excited to do all of those things! 

Java

import processing.serial.*;
import controlP5.*;

ControlP5 cp5;
Serial com;

void setup(){
 size(300, 100);
 com = new Serial(this, "COM17", 9600);
 cp5 = new ControlP5(this);
}

void draw(){
 background(0);
}

void keyTyped(){
 
 if((int) key != 8){
 com.write(key);
 }
}

void keyPressed(){
 println(key);
 
 println(keyCode);
 if((int) keyCode == 17){
 println(keyCode);
 com.write("clear");
 } 
}
/*
 * https://github.com/SaoSuoVisal/processing3/blob/master/classExamples/lifeTypeOnOled/lifeTypeOnOled.pde
 */

Leave a Reply

Your email address will not be published. Required fields are marked *