- Dim an LED from Max.
- Read the value of a potentiometer in Max.
download
https://github.com/tkzic/max-projects
folder: arduino-basics
patches:
- arduino-dimmer.maxpat
- arduino-serial-read.maxpat
Arduino dimmer
dim an LED from Max
From the Arduino playground
http://playground.arduino.cc//Code/MaxCommunicationExamples

circuit
Connect an LED to pin 9 and ground. The shorter lead goes to ground.
sketch
Load the Arduino example sketch: communications | dimmer
Max
- open arduino-dimmer.maxat
- Click the “print” message to print the list of ports to the Max window. Then set the port in the serial object, using the port message. For example: “port c”.
- Move the slider to dim the LED
Arduino serial read
Read the value of a potentiometer

This patch is a bit more involved. Refer to the Max Communications Tutorial 2: Serial Communication. In fact, much of this code was lifted from the tutorial.
circuit
- Connect an LED to pin 9 and ground. The shorter lead goes to ground.
- Connect a potentiometer (center lead) to Analog pin 0. The side leads connect to +5v and ground.
sketch
Load the Arduino example sketch: Analog | analogInOutSerial
Max
- Open arduino-serial-read.maxpat
- Click the “print” message to print the list of ports to the Max window. Then set the port in the serial object, using the port message. For example: “port c”.
- Activate toggle to start polling serial port
- Activate toggle number 3 to view formatted output in the Max window
- Turn the potentiometer to send data to Max
general suggestions:
- Try not to get discouraged.
- If weird things happen, close Max, reconnect Arduino, the re-open Max