On the arduino IDE code:
add following lines to the void start() code:
void start()
{
Serial.begin(115200); // start serial communication to Pd
}
&void start()
{
Serial.begin(115200); // start serial communication to Pd
}
add following lines to the void loop() code:
void loop()
{
...
...
enableState = digitalRead(enablepin); // read the state of the enable pin
// send the value to the serial port (Pd)
if (Serial.available() > 0)
{
enaState = Serial.read(); // receive data from Pd
digitalWrite(enablepin, enaState); // turn the leds on/off
}
...
...
}
After I uploaded the code to the Arduino and opened the PD patch, I could toggle the LEDs on and off using a toggle.
No comments:
Post a Comment