
This time, I connected two speakers. There wasn’t much change in the circuit; I simply connected one speaker to pin 10 of the Arduino in the same way as before. I connected the ‘-‘ part of the speaker to the ‘-‘ part of the breadboard, keeping in mind that I would connect more speakers later, and then connected that part to the Arduino’s GND (ground) to finish it off.

This time, I controlled it using Max/MSP. To do this, I declared a ‘char’ (a data type that can represent characters from the ASCII character set) called datafromMax and used Serial to receive information from Max. In the setup section, I set the port to 9600 using ‘Serial.begin’, and in the loop section, I used ‘Serial.available’ and ‘Serial.read’ to check if there was data coming from Max and store it in datafromMax. Then, I used an ‘if’ statement to turn the speakers on and off according to the data received from Max.

In Max, I used the toggle and metro objects to send messages of 1 or 2, and I enabled communication with the Arduino through the serial object. I also made sure to use the delay object to send 0 and 3 to turn each sound on and off.
The operation worked normally, but it wasn’t what I wanted. I wanted each sound to play individually, but probably due to the nature of the void loop, when one signal came from Max, any subsequent signals were ignored, making only the signals received while no sound was playing valid. I think I need to resolve this issue to control multiple speakers later.