#include extern "C" { #include "user_interface.h" } bool BlueLED=false; void timer1_ISR (void) { if(BlueLED){ Nefry.setLed(0, 0, 255);//青色に点灯します. BlueLED = false; }else{ Nefry.setLed(255, 0, 0); //赤色に点灯します. BlueLED = true; int value = system_adc_read(); Nefry.println("Value: " + String(value)); } } void stop_timer1() { timer1_disable(); timer1_detachInterrupt(); } void start_timer1(unsigned int nIntervalTime_us) { timer1_isr_init(); timer1_attachInterrupt(timer1_ISR); timer1_enable(TIM_DIV16, TIM_EDGE, TIM_LOOP); timer1_write(clockCyclesPerMicrosecond() / 16 * nIntervalTime_us); } void setup() { // put your setup code here, to run once: start_timer1(1000000); } void loop() { }