Adding multiple analog inputs to code


hi,

new arduino , cant figure out how code multiple analog inputs read use in puredata. want 6 potentiometers run inputs. ideas?

thanks much.

code: [select]


#include <firmata.h>

byte analogpin = 0;

void analogwritecallback(byte pin, int value)
{
    if (is_pin_pwm(pin)) {
        pinmode(pin_to_digital(pin), output);
        analogwrite(pin_to_pwm(pin), value);
    }
}

void setup()
{
    firmata.setfirmwareversion(0, 1);
    firmata.attach(analog_message, analogwritecallback);
    firmata.begin(57600);
}

void loop()
{
    while(firmata.available()) {
        firmata.processinput();
    }
    // 1 analogread per loop, if pc sending lot of
    // analog write messages, delay 1 analogread
    firmata.sendanalog(analogpin, analogread(analogpin));
    analogpin = analogpin + 1;
    if (analogpin >= total_analog_pins) analogpin = 0;
}

quote
new arduino , cant figure out how code multiple analog inputs read use in puredata. want 6 potentiometers run inputs. ideas?
it not done changing arduino code.


Arduino Forum > Using Arduino > Programming Questions > Adding multiple analog inputs to code


arduino

Comments