Code
I am finally making progress with my code but it took too long to process and figure out the bugs. it has been specifically tricky to get my full code on Arduino to understand my p5 code since i had to try many thing and innovate from things that we haven’t learned in class.
if (!serialActive) { text("Press Space Bar to select Serial Port", 20, 30); } else { text("Connected", 20, 30); } if (Contact2 ==1 && Contact3 ==0 && Contact4 ==0){ Esound.play(); } else if(Contact2 ==0 && Contact3 ==1 && Contact4 ==0){ Lsound.play(); } else if(Contact2 ==0 && Contact3 ==0 && Contact4 ==1){ Dsound.play(); } }
if (data != null) { // make sure there is actually a message // split the message let fromArduino = split(trim(data), ","); // if the right length, then proceed if (fromArduino.length == 3) { // only store values here Contact2 = fromArduino[0]; Contact3 = fromArduino[1]; Contact4 = fromArduino[2]; // do everything with those values in the main draw loop }
hile (Serial.available()) { int Contact2 = Serial.parseInt(); int Contact3 = Serial.parseInt(); if (Serial.read() == '\n') { digitalWrite(2, Contact2); digitalWrite(5, Contact3); int lion = digitalRead(2); delay(1); int elephent = digitalread(3); delay(1); Serial.print(sensor); Serial.print(','); Serial.println(sensor2); }
Exterior
I initially wanted to use wood to build the animals since it would have been easier but after having a talk with the professor i switched to a board that would have diffrent wires to connect the animal heads to. i went with origami animals after experimenting since they looked the cutest.
I just need to fully fix my code since i cant seem to find the right balance that is needed for the project