I decided to go way too far with this tech demo.  I went to the weekend long machine learning workshop at the Studio for Creative Inquiry, which made me interested in including machine learning in this project. We learned about the program Wekinator, which makes machine learning pretty easy for artists. I used Open Frameworks, Wekinator (doing Dynamic Time Warping), Wekinator Helper, Processing, and Arduino to run this.  All information was sent via OSC, except for processing sent Arduino Serial which it then understood.  Because I had an input that I could teach to understand body language, I began to think about how blinking was in a human time scale and so I decided I would start to prototype a facial morse code decoder.  If I blinked, an S would be sent to the LCD.  If I smiled, an O.  Although I am making typically normal social facial gestures, the arduino shows I am actually asking for help.  Unfortunately, running 5 programs + doing a screen capture was a bit much for my computer and it made the OSC laggy.  I have better documentation from the machine learning workshop where I did a short demo for a crowd and I (and my computer and arduino) were documented by another person. I got a lot of help this weekend, but I succeeded!

Also I had some typos. Aka SSOS.

Processing Code:


import netP5.*;
import oscP5.*;
import vsync.*;
import processing.serial.*;

OscP5 oscP5;
NetAddress dest;

public int blink;
// To sync variable to a different device we need a ValueSender
ValueSender sender;

void setup()
{
size(255,255,P2D);

Serial serial = new Serial(this, "/dev/cu.usbmodem1411", 19000);

sender = new ValueSender(this, serial);

blink=1;
sender.observe("blink");

oscP5 = new OscP5(this,12000);
dest = new NetAddress("127.0.0.1",6448);
}

void draw()
{
}

void oscEvent(OscMessage theOscMessage) {
//println(theOscMessage);
if (theOscMessage.checkAddrPattern("/wek/outputs") == true) {
if(theOscMessage.checkTypetag("fff")) {
float f = theOscMessage.get(0).floatValue();
if (int(f) ==1){
blink = 1;
}
else if (int(f) ==2 && blink != 2){
blink = 2;
println("S");
}
else if (int(f) ==3 && blink!= 3){
blink = 3;
println("O");

}
}
}
}

 

Arduino Code:

#include <VSync.h>

ValueReceiver<2> receiver;

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int blink;
int lastBlink = -1;

void setup()
{
lcd.begin(16, 2);

Serial.begin(19000);
receiver.observe(blink);

}

void loop()
{

receiver.sync();

if (blink == 2 && lastBlink!= 2){
lcd.print("S");
}
else if (blink ==3 && lastBlink!= 3){
lcd.print("O");
}
lastBlink = blink;
}