// the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. Serial.begin(115200); Serial.println("Hello"); pinMode(led_red, OUTPUT); pinMode(led_green, OUTPUT); pinMode(led_blue, OUTPUT); pinMode( 4, OUTPUT); pinMode( 6, OUTPUT); pinMode( 7, OUTPUT); pinMode( 8, OUTPUT); pinMode( 9, OUTPUT); // turn the LEDs on, glow white. digitalWrite(led_red, HIGH); digitalWrite(led_green, HIGH); digitalWrite(led_blue, HIGH); digitalWrite( 4, LOW ); digitalWrite( 6, LOW ); digitalWrite( 7, LOW ); digitalWrite( 8, LOW ); digitalWrite( 9, LOW ); outputClock( 10, 1000000 ); // 1MHz clock for the mic attachIntervalTimerHandler( MyCycle ); inputClock( true ); // Timer 0 Channel 1; を前提 }
/**************************************************************************** * Attach interval timer function * * The callback function is called every 1ms interval * @param[in] fFunction Specify callback function * * @return always 1 * ***************************************************************************/ unsigned long timer_regist_userfunc(void (*fFunction)(void)) { if (fFunction != NULL) { attachIntervalTimerHandler((void (*)(unsigned long))fFunction); } else { detachIntervalTimerHandler(); } return 1; }