top of page

Sending data to TD

Today I'm revisiting a thesis x conndev crossover project to send voting data to touchdesigner so that votes will initiate a change in video in touchdesigner.


I wrote a sketch last week that combined the fetch message client with the MQTT message client so that I could use the project for my thesis and conndev projects simultaneously but I think I need to isolate and focus on fetch only to get it working right now.


Update:

I have all my lil video clips loaded into TD, now I have to edit the Arduino sketch to initiate the correct logic. I (of course) am making this more difficult by having 2 (or more) videos per voting option to give the project a bit of variety and fun. That means I have to write some code to say "when the trigger goes off, if the last message was A, send message B"


[nice]


also, just to show that I tried to figure out the logic, here's what I had that wasn't working:



String messageOut;
String messageIn;
String messageAone = "{\"YOU VOTED YES\": 1}"; //A1
String messageAtwo = "{\"YOU VOTED YES\": 2}"; //A2
// String messageBone = "{\"YOU VOTED YES\": 3}"; //B1
// String messageBtwo = "{\"YOU VOTED YES\": 4}"; //B2

void setup() {
  //Initialize serial
  Serial.begin(9600);
  // if serial monitor's not open, wait 3 seconds:
  if (!Serial) delay(3000);

  //MAX4466 pin mode 
  pinMode(A0, INPUT);
  pinMode(13, OUTPUT);

  messageOut = messageAone;
  Serial.print("first message out = ");
  Serial.println(messageOut);
}

void loop() {

  double sound = soundDiff();
  //this is the actual reading you want
  double soundCalc = (sound * 3.3)/1024;
  // Serial.println(soundCalc);
  
  messageIn = messageOut; 
  
  if(soundCalc > 0.99){
  //format the message to match tom's example for JSON
  digitalWrite(13, HIGH);

  if (messageIn = messageAone){
    messageOut = messageAtwo;
  } else {
    messageOut = messageAone;
  }

  //send the message:
  // client.println(messageOut);
  Serial.print(messageIn);
  Serial.print(" , ");
  Serial.println(messageOut);

  lastTimeSent = millis();
  delay(2000);
  // String reset = "{\"waiting for action\": 0}";
  // client.println(reset);

  }  else{
    digitalWrite(13, LOW);
  }
}


0 views0 comments

Recent Posts

See All

I'm doing it! Finally working on the walkie talkie mobile. I took one apart, and it's such a simple mechanism! The model is a T388, and it looks like these are just mass manufactured and rebranded for

bottom of page