arduino mozziのIntMapの使い方メモ

mozziのIntMapはMapを高速で処理します。IntMapの使い方メモです。

#include <MozziGuts.h>        // at the top of your sketch
#define CONTROL_RATE 64

#include <IntMap.h> // IntMapをインクルードする。

IntMap abc(0,1024,0,200); // IntMapとしてabcを定義する。 0から1024の値を0から200に変換する

void setup() {
 startMozzi(CONTROL_RATE);
}

void updateControl() {
 // your control code

 int abc=mozziAnalogRead(0); // abcにアナログ入力を当てはめる。
 
}

int updateAudio() {
 // your audio code which returns an int between -244 and 243
 // actually, a char is fine
 return 0;
}

void loop() {
 audioHook(); // fills the audio buffer
}
​


よろしければサポートお願いします!