Hey all,
I'm trying to send two values from max to arduino to control the brightness of two led's through the PWM outputs. I can't seem to get it to work.
Here's my arduino code:
int ledPin = 6;
int ledPin2 = 10;
int pw1 = 0;
int pw2 = 0;
void setup() {
Serial.begin(57600);
}
void loop() {
//data from Max
if (Serial.available() > 0 ) {
pw1 = Serial.read();
pw2 = Serial.read();
analogWrite(ledPin,pw1);
analogWrite(ledPin2,pw2);
}
and my max code:
----------begin_max5_patcher----------
377.3oc0T1saCBBEG+Z7ofv0NCnSsr61ywRyBprV1TnQwrt0z28An1uxZmco
sY6FQNmCvuyeNGV4APYpk7FD7A3SP.XkG.3LYM.5mCPUrk4krFWXnrVsVIQ9
ctjsUBYIW67Q1ZT0pOzZmI8GK3cGGJiImgfS6cufoymKjydtlmq6hHNI.6CI
DrcHby2MKQT3HRk85cw2ir1V64Y+3Oxbw.ZFudHWdQI0MhOc3QBMm1nSwvik
hBoF4OhLkLIJflhwXhOLhFPCM+E4CiOYNGQ1kbIqxcpnGqErx+0pAM4WHFoW
Xwf+tYaG1SMeoiMCs4uAwP74nRgmWawoKThBc8DQD6PWCxQkD5MQRZ31MDxf
woIX70u74G0mgZGRZb.kPoSLEOSNoRMxZG2RQkB4guX5.wZee0qQ0VmOP+PG
KbKAE7FsPxzBy6o6DDcuflKJJ3N+CZXknXgxHF8P.m9s2kWTlLOudSYJ8OnN
QGASo2TjN3V4JHSlIq89BvuwbKI
-----------end_max5_patcher-----------
Why won't this work?