Difference between revisions of "Arduino & Pure Data"

From Interaction Station Wiki
Jump to navigation Jump to search
(Created page with "this page will explain how to set up communications between pure data and Arduino. it is easy to reading sensor values from Arduino in Pure Data, However, write to Arduino is...")
 
Line 1: Line 1:
 
this page will explain how to set up communications between pure data and Arduino.
 
this page will explain how to set up communications between pure data and Arduino.
it is easy to reading sensor values from Arduino in Pure Data, However, write to Arduino is less documentred
+
 
  
 
Pure Data write to Arduino:
 
Pure Data write to Arduino:
Line 15: Line 15:
 
  2. if some other externals are missing you can install them via PD's help window - find externals.
 
  2. if some other externals are missing you can install them via PD's help window - find externals.
 
  there is the patch that allows you to write to Arduino both in PWM and digital:
 
  there is the patch that allows you to write to Arduino both in PWM and digital:
 +
[[File:Capture-puredata-arduino-Write.PNG]]
 +
 
 +
  in this patch, we are writing to Arduino Uno pin 11, it is a PWM pin.
 +
  connect your Arduino via a USB to your computer
 +
  Click on "devices" to check the Arduino port number, in my case, it is port 4. that's why after the message "open" I type "open 4". you need to change the number according to
 +
  your own USB port.
 +
 
 +
  connect a LED between pin 11 and Ground.
 +
 
 +
  now, we click on "pinMode 11 output" and if we now click on "digital 11 1" we will turn on pin 11, and "digital 11 0" turns it off.
 +
 
 +
  if you want to dim the LED you need to use PWM.
 +
  Click on "pinMode 11 pwm" to enable PWM, and move around the yellow slider(value between 0-1), you can dim the LED now.
 +
  if you want to switch to digital output click "pwm 11 off" .

Revision as of 16:09, 11 January 2021

this page will explain how to set up communications between pure data and Arduino.


Pure Data write to Arduino:

1. Arduino:

open Arduino example firmata --- upload StanderFirmata.
and that's it! the Arduino coding part is done!

2. Pure Data:

we will need to install some externals:
1. Pduino : https://puredata.info/downloads/pduino
2. if some other externals are missing you can install them via PD's help window - find externals.
there is the patch that allows you to write to Arduino both in PWM and digital:
Capture-puredata-arduino-Write.PNG
 
 in this patch, we are writing to Arduino Uno pin 11, it is a PWM pin.
 connect your Arduino via a USB to your computer
 Click on "devices" to check the Arduino port number, in my case, it is port 4. that's why after the message "open" I type "open 4". you need to change the number according to 
 your own USB port.
 
 connect a LED between pin 11 and Ground.
 
 now, we click on "pinMode 11 output" and if we now click on "digital 11 1" we will turn on pin 11, and "digital 11 0" turns it off.
 
 if you want to dim the LED you need to use PWM. 
 Click on "pinMode 11 pwm" to enable PWM, and move around the yellow slider(value between 0-1), you can dim the LED now.
 if you want to switch to digital output click "pwm 11 off" .