Arduino+max for live

violetmono
Offline
Зарегистрирован: 11.09.2013

Всем привет! Делаю проект миди терменвокса. Не выходит связать с максом. не принимает он сообщения. 

 

 

#include <CapacitiveSensor.h>

CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);        // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
int led = 13;
void setup()                    
{
   cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF);     // turn off autocalibrate on channel 1 - just as an example
   Serial.begin(9600);
    pinMode(led, OUTPUT);    
}

void loop()                    
{
    long start = millis();
    long total1 =  cs_4_2.capacitiveSensor(1000)/8;
 

    Serial.print(total1);                  // print sensor output 1
    Serial.print("\n"); Serial.print("\n");

    delay(5);                             // arbitrary delay to limit data to serial port 
    

}

 

 

Вот код. В мониторинге порта все верно. Макс игнорирует. Кто нибудь знает как решить проблему?

 

violetmono
Offline
Зарегистрирован: 11.09.2013

уже разобрался сам давненько..  вот патч, кому вдруг понадобится

 

{
"boxes" : [ {
"box" : {
"maxclass" : "comment",
"text" : "MIDI Channel",
"frgb" : 0.0,
"numinlets" : 1,
"id" : "obj-28",
"numoutlets" : 0,
"fontname" : "Arial",
"fontsize" : 13.0,
"patching_rect" : [ 159.0, 543.0, 90.0, 21.0 ],
"textcolor" : [ 0.501961, 0.501961, 0.501961, 1.0 ]
}
 
}
, {
"box" : {
"maxclass" : "button",
"numinlets" : 1,
"id" : "obj-5",
"numoutlets" : 1,
"patching_rect" : [ 162.0, 142.0, 20.0, 20.0 ],
"outlettype" : [ "bang" ]
}
 
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "midiout",
"numinlets" : 1,
"id" : "obj-3",
"numoutlets" : 0,
"fontname" : "Arial Bold",
"fontsize" : 10.0,
"patching_rect" : [ 330.0, 142.0, 47.0, 18.0 ]
}
 
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "prepend port",
"numinlets" : 1,
"id" : "obj-18",
"numoutlets" : 1,
"fontname" : "Arial",
"color" : [ 0.8, 0.611765, 0.380392, 1.0 ],
"fontsize" : 9.0,
"patching_rect" : [ 18.0, 37.0, 62.0, 17.0 ],
"outlettype" : [ "" ]
}
 
}
, {
"box" : {
"maxclass" : "umenu",
"labelclick" : 1,
"numinlets" : 1,
"id" : "obj-19",
"numoutlets" : 3,
"fontname" : "Arial",
"fontsize" : 9.0,
"patching_rect" : [ 18.0, 10.0, 149.0, 17.0 ],
"outlettype" : [ "int", "", "" ],
"parameter_enable" : 0,
"items" : [ "Bluetooth-PDA-Sync", ",", "Bluetooth-Modem", ",", "usbmodem411" ],
"textcolor" : [ 0.047059, 0.0, 0.839216, 1.0 ]
}
 
}
, {
"box" : {
"maxclass" : "toggle",
"numinlets" : 1,
"id" : "obj-11",
"numoutlets" : 1,
"patching_rect" : [ 203.0, 12.0, 15.0, 15.0 ],
"outlettype" : [ "int" ],
"parameter_enable" : 0
}
 
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "metro 1",
"numinlets" : 2,
"id" : "obj-12",
"numoutlets" : 1,
"fontname" : "Arial Bold",
"fontsize" : 9.0,
"patching_rect" : [ 203.0, 34.0, 46.0, 17.0 ],
"outlettype" : [ "bang" ]
}
 
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "serial a 115200",
"numinlets" : 1,
"id" : "obj-14",
"numoutlets" : 2,
"fontname" : "Arial Bold",
"fontsize" : 9.0,
"patching_rect" : [ 203.0, 81.0, 74.0, 17.0 ],
"outlettype" : [ "int", "" ]
}
 
}
 ],
"lines" : [ {
"patchline" : {
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-18", 0 ],
"hidden" : 0,
"disabled" : 0
}
 
}
, {
"patchline" : {
"source" : [ "obj-18", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"disabled" : 0
}
 
}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 0,
"disabled" : 0
}
 
}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 0,
"disabled" : 0
}
 
}
, {
"patchline" : {
"source" : [ "obj-12", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"disabled" : 0
}
 
}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"disabled" : 0
}
 
}
 ],
"appversion" : {
"major" : 6,
"minor" : 1,
"revision" : 3,
"architecture" : "x86"
}
 
}