{"id":21924,"date":"2026-01-16T15:22:10","date_gmt":"2026-01-16T06:22:10","guid":{"rendered":"http:\/\/kassan.www2.jp\/?p=21924"},"modified":"2026-01-16T15:22:10","modified_gmt":"2026-01-16T06:22:10","slug":"%e4%ba%8c%e8%b6%b3%e6%ad%a9%e8%a1%8c%e3%83%ad%e3%83%9c%e3%83%83%e3%83%88%e3%80%8cotto%e3%80%8d%e3%81%9d%e3%81%ae%ef%bc%92","status":"publish","type":"post","link":"http:\/\/kassan.www2.jp\/?p=21924","title":{"rendered":"\u4e8c\u8db3\u6b69\u884c\u30ed\u30dc\u30c3\u30c8\u300cOTTO\u300d\u305d\u306e\uff12"},"content":{"rendered":"\n<p>\u3082\u3063\u3068\u90e8\u54c1\u4ee3\u3092\u5b89\u304f\u3067\u304d\u306a\u3044\u304b\u3068\u3001\u30de\u30a4\u30b3\u30f3\u3092PIC\u306b\u7f6e\u304d\u63db\u3048\u3066\u8003\u3048\u4e2d\u30fb\u30fb\u30fb\u3055\u3089\u306b\u8d64\u5916\u7dda\u30ea\u30e2\u30b3\u30f3\u3067\u52d5\u4f5c\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1920\" height=\"1080\" src=\"http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/pic16f18313.jpg\" alt=\"\" class=\"wp-image-21926\" srcset=\"http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/pic16f18313.jpg 1920w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/pic16f18313-300x169.jpg 300w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/pic16f18313-640x360.jpg 640w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/pic16f18313-768x432.jpg 768w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/pic16f18313-1536x864.jpg 1536w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/figure>\n\n\n\n<p>\u56de\u8def\u56f3<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1105\" height=\"854\" src=\"http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/588250246eb10620987879d9352412ab-1.jpg\" alt=\"\" class=\"wp-image-21925\" srcset=\"http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/588250246eb10620987879d9352412ab-1.jpg 1105w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/588250246eb10620987879d9352412ab-1-300x232.jpg 300w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/588250246eb10620987879d9352412ab-1-621x480.jpg 621w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/588250246eb10620987879d9352412ab-1-768x594.jpg 768w\" sizes=\"(max-width: 1105px) 100vw, 1105px\" \/><\/figure>\n\n\n\n<p>\u30d1\u30bf\u30fc\u30f3\u56f3<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1920\" height=\"1080\" src=\"http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/5034572d3dbc210621bd7092b006ccb7.jpg\" alt=\"\" class=\"wp-image-21927\" srcset=\"http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/5034572d3dbc210621bd7092b006ccb7.jpg 1920w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/5034572d3dbc210621bd7092b006ccb7-300x169.jpg 300w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/5034572d3dbc210621bd7092b006ccb7-640x360.jpg 640w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/5034572d3dbc210621bd7092b006ccb7-768x432.jpg 768w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/5034572d3dbc210621bd7092b006ccb7-1536x864.jpg 1536w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/figure>\n\n\n\n<p>\u90e8\u54c1\u4e00\u89a7\u3000\u3082\u304f\u308d\u307f\u307b\u3069\u5b89\u304f\u306f\u306a\u3089\u306a\u3044\u30fb\u30fb\u30fb\u3067\u304d\u308c\u3070\uff11\uff10\uff10\uff10\u5186\u4ee5\u5185\u306b\u3057\u305f\u3044<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"921\" height=\"562\" src=\"http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/66494061923c1aeb4ae61e52a937d086.jpg\" alt=\"\" class=\"wp-image-21928\" srcset=\"http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/66494061923c1aeb4ae61e52a937d086.jpg 921w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/66494061923c1aeb4ae61e52a937d086-300x183.jpg 300w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/66494061923c1aeb4ae61e52a937d086-640x391.jpg 640w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/66494061923c1aeb4ae61e52a937d086-768x469.jpg 768w\" sizes=\"(max-width: 921px) 100vw, 921px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1920\" height=\"1080\" src=\"http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/fusion-1.jpg\" alt=\"\" class=\"wp-image-21940\" srcset=\"http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/fusion-1.jpg 1920w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/fusion-1-300x169.jpg 300w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/fusion-1-640x360.jpg 640w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/fusion-1-768x432.jpg 768w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/fusion-1-1536x864.jpg 1536w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"4032\" height=\"3024\" src=\"http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/IMG_9496.jpg\" alt=\"\" class=\"wp-image-21929\" srcset=\"http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/IMG_9496.jpg 4032w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/IMG_9496-300x225.jpg 300w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/IMG_9496-640x480.jpg 640w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/IMG_9496-768x576.jpg 768w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/IMG_9496-1536x1152.jpg 1536w, http:\/\/kassan.www2.jp\/wp-content\/uploads\/2026\/01\/IMG_9496-2048x1536.jpg 2048w\" sizes=\"(max-width: 4032px) 100vw, 4032px\" \/><\/figure>\n\n\n\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u306fXC8\u3067\u3001gemini\u3067\u751f\u6210\u3055\u305b\u305f\u3082\u306e\u3092\u30d9\u30fc\u30b9\u306b\u4f5c\u6210\u3002\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2PWM\u3092\u4f7f\u7528\u3057\u305f\u3051\u3069\u4f55\u3068\u304b\u6b69\u304f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-light-green-cyan-background-color has-background\">\/\/--------------------------------------------------------------------------\n\/\/   OTTO by PIC16F18313   2025\/10\/30\n\/\/--------------------------------------------------------------------------\n\n#include &lt;xc.h&gt;\n#define _XTAL_FREQ 32000000UL\n\n\/\/ \u30b3\u30f3\u30d5\u30a3\u30ae\u30e5\u30ec\u30fc\u30b7\u30e7\u30f3\u30d3\u30c3\u30c8\u8a2d\u5b9a (\u5185\u90e832MHz\u30af\u30ed\u30c3\u30af\u3092\u60f3\u5b9a)\n\n\/\/ CONFIG1\n#pragma config FEXTOSC = OFF    \/\/ FEXTOSC External Oscillator mode Selection bits (Oscillator not enabled)\n#pragma config RSTOSC = HFINT32 \/\/ Power-up default value for COSC bits (HFINTOSC with 2x PLL (32MHz))\n#pragma config CLKOUTEN = OFF   \/\/ Clock Out Enable bit (CLKOUT function is disabled; I\/O or oscillator function on OSC2)\n#pragma config CSWEN = OFF      \/\/ Clock Switch Enable bit (The NOSC and NDIV bits cannot be changed by user software)\n#pragma config FCMEN = OFF      \/\/ Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is disabled)\n\n\/\/ CONFIG2\n#pragma config MCLRE = OFF       \/\/ Master Clear Enable bit (MCLR\/VPP pin function is MCLR; Weak pull-up enabled )\n#pragma config PWRTE = OFF      \/\/ Power-up Timer Enable bit (PWRT disabled)\n#pragma config WDTE = OFF       \/\/ Watchdog Timer Enable bits (WDT disabled; SWDTEN is ignored)\n#pragma config LPBOREN = OFF    \/\/ Low-power BOR enable bit (ULPBOR disabled)\n#pragma config BOREN = OFF      \/\/ Brown-out Reset Enable bits (Brown-out Reset disabled)\n#pragma config BORV = LOW       \/\/ Brown-out Reset Voltage selection bit (Brown-out voltage (Vbor) set to 2.45V)\n#pragma config PPS1WAY = OFF    \/\/ PPSLOCK bit One-Way Set Enable bit (The PPSLOCK bit can be set and cleared repeatedly (subject to the unlock sequence))\n#pragma config STVREN = OFF     \/\/ Stack Overflow\/Underflow Reset Enable bit (Stack Overflow or Underflow will not cause a Reset)\n#pragma config DEBUG = OFF      \/\/ Debugger enable bit (Background debugger disabled)\n\n\/\/ CONFIG3\n#pragma config WRT = OFF        \/\/ User NVM self-write protection bits (Write protection off)\n#pragma config LVP = OFF        \/\/ Low Voltage Programming Enable bit (HV on MCLR\/VPP must be used for programming.)\n\n\/\/ CONFIG4\n#pragma config CP = OFF         \/\/ User NVM Program Memory Code Protection bit (User NVM code protection disabled)\n#pragma config CPD = OFF        \/\/ Data NVM Memory Code Protection bit (Data NVM code protection disabled)\n\n\/\/ -----------------------------------------------------------------------------\n\/\/ \u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\n\/\/ -----------------------------------------------------------------------------\n\n\/\/ 4\u3064\u306e\u30b5\u30fc\u30dc\u306e\u30d1\u30eb\u30b9\u5e45\u30c7\u30fc\u30bf (100us\u5358\u4f4d\u306e\u30ab\u30a6\u30f3\u30c8\u6570: 1000us\/100us=10 ? 2000us\/100us=20)\nvolatile unsigned char servo_pulse_count[4] = {15, 15, 15, 15}; \/\/ 15: 1.5ms (\u30cb\u30e5\u30fc\u30c8\u30e9\u30eb)\n\n\/\/ \u30bd\u30d5\u30c8\u30a6\u30a7\u30a2PWM\u7528\u30ab\u30a6\u30f3\u30bf (0?199\u306720ms\u5468\u671f\u3092\u5f62\u6210)\nvolatile unsigned char soft_pwm_counter_100us = 0;\n\n\/\/ -----------------------------------------------------------------------------\n\/\/ \u521d\u671f\u5316\u95a2\u6570\n\/\/ -----------------------------------------------------------------------------\nvoid Initialize_System(void) {\n    \/\/ 1. \u30af\u30ed\u30c3\u30af\u8a2d\u5b9a (\u5185\u90e832MHz)\n    OSCCON1 = 0b01100000;   \/\/ NOSC = 110 (HFINTOSC), NDIV = 0000 (FOSC=32MHz)\n\n    \/\/ 2. I\/O\u30d4\u30f3\u8a2d\u5b9a\n    ANSELA = 0x00;          \/\/ PORTA\u3092\u5168\u3066\u30c7\u30b8\u30bf\u30eb\u5165\u51fa\u529b\u306b\u8a2d\u5b9a\n    TRISA  = 0x00;          \/\/ PORTA\u306e\u5168\u3066\u3092\u51fa\u529b\u306b\u8a2d\u5b9a\n    LATA   = 0x00;          \/\/ \u521d\u671f\u72b6\u614b\u3092LOW\u306b\n\n    \/\/ \u4e0d\u8981\u306a\u5468\u8fba\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u7121\u52b9\u5316\n    CM1CON0 = 0x00;         \/\/ \u30b3\u30f3\u30d1\u30ec\u30fc\u30bf1\u7121\u52b9\n    DACCON0bits.DAC1EN = 0; \/\/ DAC\u3092\u7121\u52b9\u5316\n\n    \/\/ 3. Timer 0 \u8a2d\u5b9a - \u30bd\u30d5\u30c8\u30a6\u30a7\u30a2PWM\u7528 (100us\u5272\u308a\u8fbc\u307f)\n    \/\/ TMR0\u30ea\u30ed\u30fc\u30c9\u5024: 65536 - 100 = 65436 (0xFEFC)\n    TMR0H = 0xFE;           \n    TMR0L = 0xFC;\n    \n    T0CON1 = 0b01001000;    \/\/ T0CS=010 (FOSC\/4), T0CKPS=1000 (Prescaler 1:8)\n    T0CON0 = 0b10000000;    \/\/ T0EN=1, 16bit\u30e2\u30fc\u30c9\n\n    \/\/ 4. \u5272\u308a\u8fbc\u307f\u8a2d\u5b9a\n    PIR0bits.TMR0IF = 0;    \/\/ TMR0\u5272\u308a\u8fbc\u307f\u30d5\u30e9\u30b0\u30af\u30ea\u30a2\n    PIE0bits.TMR0IE = 1;    \/\/ TMR0\u5272\u308a\u8fbc\u307f\u6709\u52b9\u5316\n    INTCONbits.PEIE = 1;    \/\/ \u5468\u8fba\u5272\u308a\u8fbc\u307f\u6709\u52b9\u5316\n    INTCONbits.GIE = 1;     \/\/ \u5168\u4f53\u5272\u308a\u8fbc\u307f\u6709\u52b9\u5316\n}\n\n\/\/ -----------------------------------------------------------------------------\n\/\/ \u5272\u308a\u8fbc\u307f\u30b5\u30fc\u30d3\u30b9\u30eb\u30fc\u30c1\u30f3 (ISR)\n\/\/ -----------------------------------------------------------------------------\nvoid __interrupt() ISR(void) {\n    \/\/ TMR0\u5272\u308a\u8fbc\u307f\u51e6\u7406 (100us\u3054\u3068)\n    if (PIR0bits.TMR0IF) {\n        PIR0bits.TMR0IF = 0;    \/\/ \u5272\u308a\u8fbc\u307f\u30d5\u30e9\u30b0\u30af\u30ea\u30a2\n        \n        \/\/ TMR0\u30ea\u30ed\u30fc\u30c9 (100us\u5468\u671f\u7dad\u6301)\n        TMR0H = 0xFE;           \n        TMR0L = 0xFC;\n        \n        soft_pwm_counter_100us++;\n        \n        \/\/ 20ms (200\u30ab\u30a6\u30f3\u30c8) \u5468\u671f\u306e\u958b\u59cb\n        if (soft_pwm_counter_100us &gt;= 200) {\n            soft_pwm_counter_100us = 0;\n            \/\/ \u5468\u671f\u958b\u59cb\u6642\u306b\u5168\u3066\u306e\u30b5\u30fc\u30dc\u30d4\u30f3\u3092HIGH\u306b\u3059\u308b\n            LATAbits.LATA1 = 1; \/\/ Servo 1 HIGH\n            LATAbits.LATA2 = 1; \/\/ Servo 2 HIGH\n            LATAbits.LATA0 = 1; \/\/ Servo 3 HIGH\n            LATAbits.LATA4 = 1; \/\/ Servo 4 HIGH\n        }\n\n        \/\/ \u30bd\u30d5\u30c8\u30a6\u30a7\u30a2PWM\u306eLOW\u3078\u306e\u5207\u308a\u66ff\u3048\u5224\u5b9a\n        \/\/ \u30ab\u30a6\u30f3\u30bf\u5024\u304c\u30d1\u30eb\u30b9\u5e45\u306e\u76ee\u6a19\u30ab\u30a6\u30f3\u30c8\u6570\u3092\u8d85\u3048\u305f\u3089LOW\u306b\u8a2d\u5b9a\n        \/\/ \u4f8b: pulse_count[0]=15 (1.5ms) \u306e\u5834\u5408\u3001\u30ab\u30a6\u30f3\u30bf\u304c15\u306b\u306a\u3063\u305f\u3089LOW\n        \n        if (soft_pwm_counter_100us == servo_pulse_count[0]) {\n            LATAbits.LATA1 = 0; \/\/ Servo 1 LOW\n        }\n        if (soft_pwm_counter_100us == servo_pulse_count[1]) {\n            LATAbits.LATA2 = 0; \/\/ Servo 2 LOW\n        }\n        if (soft_pwm_counter_100us == servo_pulse_count[2]) {\n            LATAbits.LATA0 = 0; \/\/ Servo 3 LOW\n        }\n        if (soft_pwm_counter_100us == servo_pulse_count[3]) {\n            LATAbits.LATA4 = 0; \/\/ Servo 4 LOW\n        }\n    }\n}\n\n\/\/ -----------------------------------------------------------------------------\n\/\/ \u89d2\u5ea6\u8a2d\u5b9a\u95a2\u6570 (\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7)\n\/\/ -----------------------------------------------------------------------------\n\/**\n * @brief \u30b5\u30fc\u30dc\u306e\u30d1\u30eb\u30b9\u5e45\u3092\u8a2d\u5b9a\u3059\u308b\n * @param servo_num \u30b5\u30fc\u30dc\u756a\u53f7 (0?3)\n * @param pulse_us \u30d1\u30eb\u30b9\u5e45 (1000us?2000us)\n *\/\nvoid set_servo_pulse(unsigned char servo_num, unsigned int pulse_us) {\n    unsigned char pulse_count;\n\n    \/\/ \u7bc4\u56f2\u30c1\u30a7\u30c3\u30af (1000us?2000us\u306b\u30af\u30e9\u30f3\u30d7)\n    if (pulse_us &lt; 500) pulse_us = 500;\n    if (pulse_us &gt; 2400) pulse_us = 2400;\n\n    \/\/ us\u5358\u4f4d\u304b\u3089100us\u5358\u4f4d\u306e\u30ab\u30a6\u30f3\u30c8\u6570\u306b\u5909\u63db\n    \/\/ 1000us -&gt; 10, 1500us -&gt; 15, 2000us -&gt; 20\n    pulse_count = (unsigned char)(pulse_us \/ 100);\n\n    if (servo_num &lt;= 3) {\n        \/\/ \u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3092\u66f4\u65b0 (ISR\u304c\u6b21\u5468\u671f\u3067\u53c2\u7167)\n        servo_pulse_count[servo_num] = pulse_count;\n    }\n}\n\n\/\/ -----------------------------------------------------------------------------\n\/\/ \u89d2\u5ea6\u6307\u5b9a\u95a2\u6570 (\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7)\n\/\/ -----------------------------------------------------------------------------\n\/**\n * @brief \u30b5\u30fc\u30dc\u30e2\u30fc\u30bf\u3092\u6307\u5b9a\u89d2\u5ea6\u3067\u52d5\u304b\u3059\n * @param servo_num \u30b5\u30fc\u30dc\u756a\u53f7 (0?3)\n * @param angle_deg \u89d2\u5ea6 (0?180\u5ea6)\n *\/\n#define MIN_PULSE_US 500  \/\/ \u2605 SG90\u306e\u6700\u5c0f\u30d1\u30eb\u30b9\u5e45 (500us\u4ed8\u8fd1\u304b\u3089\u8abf\u6574)\n#define MAX_PULSE_US 2400 \/\/ \u2605 SG90\u306e\u6700\u5927\u30d1\u30eb\u30b9\u5e45 (2500us\u4ed8\u8fd1\u307e\u3067\u5e83\u3052\u3066\u307f\u308b)\n#define PULSE_RANGE (MAX_PULSE_US - MIN_PULSE_US) \/\/ 2000us\n#define ANGLE_RANGE 180   \/\/ 180\u5ea6\n\nvoid set_servo_angle(unsigned char servo_num, unsigned int angle_deg) {\n    unsigned int pulse_us;\n\n    \/\/ \u7bc4\u56f2\u30c1\u30a7\u30c3\u30af (0?180\u5ea6\u306b\u30af\u30e9\u30f3\u30d7)\n    if (angle_deg &gt; ANGLE_RANGE) angle_deg = ANGLE_RANGE;\n\n    \/\/ pulse_us = (angle_deg * PULSE_RANGE) \/ ANGLE_RANGE + MIN_PULSE_US\n    \/\/ pulse_us = (angle_deg * 1900) \/ 180 + 500\n    \/\/ 2000\/180\u3092\u7d04\u5206\u3057\u3066 190\/18 \u306b\u3057\u307e\u3059\n    \n    pulse_us = (angle_deg * 190) \/ 18 + MIN_PULSE_US;\n    \n    \/\/ \u30d1\u30eb\u30b9\u5e45\u3092 us \u5358\u4f4d\u3067\u8a2d\u5b9a\n    set_servo_pulse(servo_num, pulse_us);\n}\nvoid my_delay_ms(unsigned int t){\n    for(unsigned int i=0; i&lt;t;i++)\n        __delay_us(950);\n}\n\n#define LL 0\n#define RL 1\n#define LF 2\n#define RF 3\n\n#define LLS 100                          \/\/ \u76f4\u7acb\u6642\u306e\u30b5\u30fc\u30dc\u89d2\u5ea6\n#define RLS 90\n#define LFS 90\n#define RFS 100\n\nint LLN,RLN,LFN,RFN;\nLLN=LLS;  RLN=RLS;  LFN=LFS;  RFN=RFS; \n\nvoid upright(){\n    set_servo_angle( LL,LLS);\n    set_servo_angle( RL,RLS);\n    set_servo_angle( LF,LFS);\n    set_servo_angle( RF,RFS);\n}\n\nvoid forward_walk(unsigned int step_time){\n    set_servo_angle( RF, RFS - 30 );\n    set_servo_angle( LF, LFS - 15 );\n    my_delay_ms(step_time);\n    \n    set_servo_angle( LL, LLS + 25 );\n    set_servo_angle( RL, RLS + 25 );\n    my_delay_ms(step_time);\n    \n    set_servo_angle( LF, LFS + 30 );\n    set_servo_angle( RF, RFS + 15 );\n    my_delay_ms(step_time);\n    \n    set_servo_angle( LL, LLS - 25 );\n    set_servo_angle( RL, RLS - 25 );\n    my_delay_ms(step_time);\n}\n\nvoid angle_to_angle( unsigned char servo1, unsigned int start1, unsigned int end1,unsigned int ms){\n    unsigned int deg;\n    for(deg=start1; deg&lt;=end1; deg+=1){\n        set_servo_angle( servo1,deg);\n        my_delay_ms(ms);\n    }\n}\n\nvoid forward_walk2(unsigned int step_time){\n    angle_to_angle( RF, RFN , RFN - 30, 50);\n    \/\/angle_to_angle( LF, LFN, LFN - 15, 50 );\n    RFN = RFN -30;\n    \/\/LFN = LFN -15;\n    my_delay_ms(step_time);\n    \n    angle_to_angle( RF, RFN , RFN + 30, 50);\n    \/\/angle_to_angle( LF, LFN, LFN + 15, 50 );\n    RFN = RFN +30;\n    \/\/LFN = LFN +15;\n    my_delay_ms(step_time);    \n}\n\n\n\/\/ -----------------------------------------------------------------------------\n\/\/ \u30e1\u30a4\u30f3\u95a2\u6570\n\/\/ -----------------------------------------------------------------------------\nvoid main(void) {\n    Initialize_System();\n\n    upright();\n    my_delay_ms(2000);\n\n    while (1) {\n        LATAbits.LATA5 = 0; \/\/ LED ON\n        forward_walk(300);\n        LATAbits.LATA5 = 1; \/\/ LED OFF\n        forward_walk(300);\n       \n    }\n}<\/pre>\n\n\n\n<p>\u8d64\u5916\u7dda\u306f\u3053\u308c\u304b\u3089\u30fb\u30fb\u30fb<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3082\u3063\u3068\u90e8\u54c1\u4ee3\u3092\u5b89\u304f\u3067\u304d\u306a\u3044\u304b\u3068\u3001\u30de\u30a4\u30b3\u30f3\u3092PIC\u306b\u7f6e\u304d\u63db\u3048\u3066\u8003\u3048\u4e2d\u30fb\u30fb\u30fb\u3055\u3089\u306b\u8d64\u5916\u7dda\u30ea\u30e2\u30b3\u30f3\u3067\u52d5\u4f5c\u3059\u308b\u3088\u3046\u306b\u3057\u305f\u3044\u3002 \u56de\u8def\u56f3 \u30d1\u30bf\u30fc\u30f3\u56f3 \u90e8\u54c1\u4e00\u89a7\u3000\u3082\u304f\u308d\u307f\u307b\u3069\u5b89\u304f\u306f\u306a\u3089\u306a\u3044\u30fb\u30fb\u30fb\u3067\u304d\u308c\u3070\uff11\uff10\uff10\uff10\u5186\u4ee5\u5185\u306b\u3057\u305f\u3044 \u30d7\u30ed\u30b0\u30e9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":21929,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[11,12],"tags":[],"_links":{"self":[{"href":"http:\/\/kassan.www2.jp\/index.php?rest_route=\/wp\/v2\/posts\/21924"}],"collection":[{"href":"http:\/\/kassan.www2.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kassan.www2.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kassan.www2.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/kassan.www2.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=21924"}],"version-history":[{"count":3,"href":"http:\/\/kassan.www2.jp\/index.php?rest_route=\/wp\/v2\/posts\/21924\/revisions"}],"predecessor-version":[{"id":21941,"href":"http:\/\/kassan.www2.jp\/index.php?rest_route=\/wp\/v2\/posts\/21924\/revisions\/21941"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/kassan.www2.jp\/index.php?rest_route=\/wp\/v2\/media\/21929"}],"wp:attachment":[{"href":"http:\/\/kassan.www2.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=21924"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kassan.www2.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=21924"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kassan.www2.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=21924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}