2Chx3dof Magnetrometer supported M-Series Random Sequence Generator Servo Control

Dependencies:   mbed

Sampling Frequency

Sampling Frequency in main.cpp

#define SampleFreq     200   // [Hz]

Auto Stop Setting

Auto-stop Timer 15sec after

    // auto-stop when 15sec after
    if(smpl_cnt>3000){stop_dump();}

The number of 3000 means Sample Count. The number is given by SampleFreq[Hz] * Auto-Stop Time [sec].

M-Series Random Sequence

M-series Random Update Term in main.cpp

// M-series update flag
#define  M_TERM  200;

Unit is sample count.

cf.) 200 equals to 200 [samples] which equals to 1 [second] where SampleFreq = 200 [Hz}.

See above.

M-Series Random Servo Control

error_led_flash.h

Committer:
mfurukawa
Date:
2021-02-10
Branch:
MPU-9250-MagSensServo
Revision:
11:f23a77c2296d
Parent:
3:70be84fad39e

File content as of revision 11:f23a77c2296d:

//
// Error Indicator using LED flash
//
// Masahiro Furukawa, m.furukawa@ist.osaka-u.ac.jp
// Feb 2, 2021

#ifndef __ERROR_LED_FLASH_H__
#define __ERROR_LED_FLASH_H__

DigitalOut myLED1(LED1);
DigitalOut myLED2(LED2);
DigitalOut myLED3(LED3);
DigitalOut myLED4(LED4);

void LED_flash_error_notice(int ch)
{
    DigitalOut *p;
    switch(ch) {
        case 0:
            p = &myLED1;
            break;
        case 1:
            p = &myLED2;
            break;
        case 2:
            p = &myLED3;
            break;
        case 3:
            p = &myLED4;
            break;
    }

    while(1) {
        *p = 1;
        wait(0.1);
        *p = 0;
        wait(0.1);
    }
}

#endif // __ERROR_LED_FLASH_H__