1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Raspberry Pi PicoでArducam OV2640を使う

Posted at

やってること

Arducam OV2640で写真を撮影し、接続したSDカードに保存する。

環境

マイコン:Raspberry Pi Pico
プログラミング言語:MicroPython
カメラ:Arducam OV2640
SDカードモジュール:AE-MICRO-SD-DIP

参考サイト

stack overflow「Arducam ov2640 camera not taking/returning data on pico」

注意

・circuit pythonではありません
・他のArducamやSPI Camで使えるかはわかりません
・JPEGでの撮影のみです
stack overflowのページの一番下のコメントに記載されていたプログラムをAI(たしかCopilot)に修正させたのちSDカードに保存するコードを追加しました。
・SDカードではなく、Pico本体に写真を保存するプログラムもあります。必要な方はコメントで教えて下さい。

接続

Pico_Arducam_Wiring.png
↑上記の画像のPicoとOV2640の接続のみ真似してくれればOKです。
↓下記はPicoとSD-DIPとの接続dえす。

Pico SD-DIP
GP13 2(CD/DAT3)
GP11 3(CMD)
VSYS 4(VDD 3.3v)
GP10 5(CLK)
GND 6(VSS GND)
GP12 7(DAT0)

プログラム

メインプログラム

OV2640_sd.py
from ov2640_reg import *
from machine import Pin, I2C, SPI
import time
import os
import sdcard

class ov2640(object):
    def __init__(self):
        # SPI 設定
        self.spi = SPI(id=0, baudrate=4000000, bits=8, sck=Pin(2), mosi=Pin(3), miso=Pin(4))
        self.cspin = Pin(5, Pin.OUT, value=1)
        
        # SDカード SPI設定
        self.sd_spi = SPI(1, baudrate=1000000, sck=Pin(10), mosi=Pin(11), miso=Pin(12))
        self.sd_cs = Pin(13, Pin.OUT)
        self.sd = sdcard.SDCard(self.sd_spi, self.sd_cs)
        
        # SDカードをマウント
        self.mount_sdcard()

        # I2C 設定
        self.I2cAddress = 0x30  # SENSORADDR
        self.i2c = I2C(0, scl=Pin(9), sda=Pin(8), freq=1000000)
        print("I2Cデバイス:", self.i2c.scan())
        
    def Camera_Detection(self):
        self.wrSensorReg8_8(0xff, 0x01)
        id_h = self.rdSensorReg8_8(0x0a)
        id_l = self.rdSensorReg8_8(0x0b)
        print("id_h", id_h, "id_l", id_l)        

    def mount_sdcard(self):
        # SDカードをマウント
        self.sd_root = "/sd"
        os.mount(self.sd, self.sd_root)
        print("SDカードマウント完了")

    def spi_Test(self):
        self.spi_write(0x00, 0x56)
        value = self.spi_read(0x00)
        if value[0] == 0x56:
            print("SPI interface OK")
        else:
            print("SPI interface Error")

    def spi_write(self, address, value):
        maskbits = 0x80
        buffer = bytearray(2)
        buffer[0] = address | maskbits
        buffer[1] = value
        self.cspin(0)
        self.spi.write(buffer)
        self.cspin(1)

    def spi_read(self, address):
        maskbits = 0x7F
        buffer = bytearray(1)
        buffer[0] = address & maskbits
        self.cspin(0)
        self.spi.write(buffer)  # アドレス送信
        data = self.spi.read(1)  # データ受信
        self.cspin(1)
        return data
    
    def spi_read_father(self, number, address):
        maskbits = 0x7f
        buffer = bytearray(1)
        buffer[0] = address & maskbits
        self.cspin(0)
        self.spi.write(buffer)
        val = self.spi.read(number)
        self.cspin(1)
        return val
    
    def spi_read(self, address):
        return self.spi_read_father(1, address)
    
    def spi_reads(self, number, address):
        return self.spi_read_father(number, address)
    
    def iic_write(self, buffer):
        self.i2c.writeto(self.I2cAddress, buffer)
    
    def iic_read(self, buffer):
        self.i2c.readfrom_into(self.I2cAddress, buffer)
    
    def wrSensorReg8_8(self, address, val):
        buffer = bytearray(2)
        buffer[0] = address
        buffer[1] = val
        self.iic_write(buffer)
    
    def rdSensorReg8_8(self, address):
        buffer = bytearray(1)
        buffer[0] = address
        self.iic_write(buffer)
        self.iic_read(buffer)
        return buffer[0]

    def wrSensorRegs8_8(self, reg_value):
        for data in reg_value:
            addr = data[0]
            val = data[1]
            if addr == 0xff and val == 0xff:
                return 
            self.wrSensorReg8_8(addr, val)
        
    def Camera_Init(self):
        self.wrSensorReg8_8(0xff,0x01)
        self.wrSensorReg8_8(0x12,0x80)
        time.sleep(0.1)
        self.wrSensorRegs8_8(OV2640_JPEG_INIT);
        self.wrSensorRegs8_8(OV2640_YUV422);
        self.wrSensorRegs8_8(OV2640_JPEG);
        self.wrSensorReg8_8(0xff,0x01)
        self.wrSensorReg8_8(0x15,0x00)
        self.wrSensorRegs8_8(OV2640_1600x1200_JPEG);
        #OV2640_set_Light_Mode
        self.wrSensorReg8_8(0xff,0x00)
        self.wrSensorReg8_8(0xc7,0x40)
        self.wrSensorReg8_8(0xcc,0x52)
        self.wrSensorReg8_8(0xcd,0x41)
        self.wrSensorReg8_8(0xce,0x66)
        #OV2640_set_Color_Saturation 色度
        self.wrSensorReg8_8(0xff, 0x00)
        self.wrSensorReg8_8(0x7c, 0x00)
        self.wrSensorReg8_8(0x7d, 0x02)
        self.wrSensorReg8_8(0x7c, 0x03)
        self.wrSensorReg8_8(0x7d, 0x28)
        self.wrSensorReg8_8(0x7d, 0x28)
        #OV2640_set_Brightness 亮度
        self.wrSensorReg8_8(0xff, 0x00)
        self.wrSensorReg8_8(0x7c, 0x00)
        self.wrSensorReg8_8(0x7d, 0x04)
        self.wrSensorReg8_8(0x7c, 0x09)
        self.wrSensorReg8_8(0x7d, 0x00)
        self.wrSensorReg8_8(0x7d, 0x00)
    

        #OV2640_set_Contrast 對比
        self.wrSensorReg8_8(0xff, 0x00)
        self.wrSensorReg8_8(0x7c, 0x00)
        self.wrSensorReg8_8(0x7d, 0x04)
        self.wrSensorReg8_8(0x7c, 0x07)
        self.wrSensorReg8_8(0x7d, 0x20)
        self.wrSensorReg8_8(0x7d, 0x18)
        self.wrSensorReg8_8(0x7d, 0x34)
        self.wrSensorReg8_8(0x7d, 0x06)  

    def read_fifo_length(self):
        len1 = self.spi_read(0x42)[0]
        len2 = self.spi_read(0x43)[0]
        len3 = self.spi_read(0x44)[0] & 0x7f
        length = ((len3 << 16) | (len2 << 8) | len1) & 0x07fffff
        print("FIFO length:", length)
        return length

    def flush_fifo(self):
        self.spi_write(0x04, 0x01)
    
    def clear_fifo_flag(self):
        self.spi_write(0x04, 0x01)
    
    def start_capture(self):
        self.spi_write(0x04, 0x02)

    def get_unique_filename(self, base_name):
        number = 1
        while True:
            filename = f"{base_name}_{number}.jpg"
            filepath = f"{self.sd_root}/{filename}"
            # SDカード内のファイル名一覧を取得
            files = os.listdir(self.sd_root)
            if filename not in files:
                return filename
            number += 1

    def appendbuf(self, base_name, picbuf, howmany):
        # ユニークなファイル名を生成
        filename = self.get_unique_filename(base_name)
        sd_filename = f"{self.sd_root}/{filename}"
        try:
            with open(sd_filename, 'ab') as f:  # 'ab'でバイナリ追加モード
                f.write(picbuf)
            print(f"SDカードに{filename}を書き込み:", howmany, "バイト")
        except OSError:
            print("SDカード書き込みエラー")

    def read_fifo_burst(self):
        self.flush_fifo()
        self.start_capture()
        length = self.read_fifo_length()
        buffer = self.spi_reads(length, 0x3d)
        self.appendbuf("image", buffer, length)  # "image"を基に番号付きファイル名を作成
        self.clear_fifo_flag()


def test():
    cam = ov2640()        
    cam.spi_Test()
    cam.Camera_Init()
    cam.clear_fifo_flag()
    time.sleep(0.01)
    cam.read_fifo_length()
    cam.read_fifo_burst()

if __name__ == '__main__':
    test()

OV2640_SD.pyでimportしているファイル

ov2640_reg.py
OV2640_JPEG_INIT =[
  [ 0xff, 0x00 ],
  [ 0x2c, 0xff ],
  [ 0x2e, 0xdf ],
  [ 0xff, 0x01 ],
  [ 0x3c, 0x32 ],
  [ 0x11, 0x00 ],   
  [ 0x09, 0x02 ],
  [ 0x04, 0x28 ],
  [ 0x13, 0xe5 ], 
  [ 0x14, 0x48 ],
  [ 0x2c, 0x0c ],
  [ 0x33, 0x78 ],
  [ 0x3a, 0x33 ],
  [ 0x3b, 0xfB ],
  [ 0x3e, 0x00 ],
  [ 0x43, 0x11 ],
  [ 0x16, 0x10 ],
  [ 0x39, 0x92 ],
  [ 0x35, 0xda ],
  [ 0x22, 0x1a ],
  [ 0x37, 0xc3 ],
  [ 0x23, 0x00 ],
  [ 0x34, 0xc0 ],
  [ 0x36, 0x1a ],
  [ 0x06, 0x88 ],
  [ 0x07, 0xc0 ],
  [ 0x0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x94 ],
  [ 0xb2, 0x0f ],
  [ 0xc4, 0x5c ],
  [ 0xc0, 0x64 ],
  [ 0xc1, 0x4B ],
  [ 0x8c, 0x00 ],
  [ 0x86, 0x3D ],
  [ 0x50, 0x00 ],
  [ 0x51, 0xC8 ],
  [ 0x52, 0x96 ],
  [ 0x53, 0x00 ],
  [ 0x54, 0x00 ],
  [ 0x55, 0x00 ],
  [ 0x5a, 0xC8 ],
  [ 0x5b, 0x96 ],
  [ 0x5c, 0x00 ],
  [ 0xd3, 0x00 ],   
  [ 0xc3, 0xed ],
  [ 0x7f, 0x00 ],
  [ 0xda, 0x00 ],
  [ 0xe5, 0x1f ],
  [ 0xe1, 0x67 ],
  [ 0xe0, 0x00 ],
  [ 0xdd, 0x7f ],
  [ 0x05, 0x00 ],
  [ 0x12, 0x40 ],
  [ 0xd3, 0x04 ],   
  [ 0xc0, 0x16 ],
  [ 0xC1, 0x12 ],
  [ 0x8c, 0x00 ],
  [ 0x86, 0x3d ],
  [ 0x50, 0x00 ],
  [ 0x51, 0x2C ],
  [ 0x52, 0x24 ],
  [ 0x53, 0x00 ],
  [ 0x54, 0x00 ],
  [ 0x55, 0x00 ],
  [ 0x5A, 0x2c ],
  [ 0x5b, 0x24 ],
  [ 0x5c, 0x00 ],
  [ 0xff, 0xff ],
]

OV2640_YUV422=[
  [ 0xFF, 0x00 ],
  [ 0x05, 0x00 ],
  [ 0xDA, 0x10 ],
  [ 0xD7, 0x03 ],
  [ 0xDF, 0x00 ],
  [ 0x33, 0x80 ],
  [ 0x3C, 0x40 ],
  [ 0xe1, 0x77 ],
  [ 0x00, 0x00 ],
  [ 0xff, 0xff ],
]

OV2640_JPEG= [
  [ 0xe0, 0x14 ],
  [ 0xe1, 0x77 ],
  [ 0xe5, 0x1f ],
  [ 0xd7, 0x03 ],
  [ 0xda, 0x10 ],
  [ 0xe0, 0x00 ],
  [ 0xFF, 0x01 ],
  [ 0x04, 0x08 ],
  [ 0xff, 0xff ],
]




OV2640_160x120_JPEG = [
  [ 0xff, 0x01 ],
  [ 0x12, 0x40 ],
  [ 0x17, 0x11 ],
  [ 0x18, 0x43 ],
  [ 0x19, 0x00 ],
  [ 0x1a, 0x4b ],
  [ 0x32, 0x09 ],
  [ 0x4f, 0xca ],
  [ 0x50, 0xa8 ],
  [ 0x5a, 0x23 ],
  [ 0x6d, 0x00 ],
  [ 0x39, 0x12 ],
  [ 0x35, 0xda ],
  [ 0x22, 0x1a ],
  [ 0x37, 0xc3 ],
  [ 0x23, 0x00 ],
  [ 0x34, 0xc0 ],
  [ 0x36, 0x1a ],
  [ 0x06, 0x88 ],
  [ 0x07, 0xc0 ],
  [ 0x0d, 0x87 ],
  [ 0x0e, 0x41 ],
  [ 0x4c, 0x00 ],
  [ 0xff, 0x00 ],
  [ 0xe0, 0x04 ],
  [ 0xc0, 0x64 ],
  [ 0xc1, 0x4b ],
  [ 0x86, 0x35 ],
  [ 0x50, 0x92 ],
  [ 0x51, 0xc8 ],
  [ 0x52, 0x96 ],
  [ 0x53, 0x00 ],
  [ 0x54, 0x00 ],
  [ 0x55, 0x00 ],
  [ 0x57, 0x00 ],
  [ 0x5a, 0x28 ],
  [ 0x5b, 0x1e ],
  [ 0x5c, 0x00 ],
  [ 0xe0, 0x00 ],
  [ 0xff, 0xff ],
]

OV2640_176x144_JPEG=[
  [ 0xff, 0x01 ],
  [ 0x12, 0x40 ],
  [ 0x17, 0x11 ],
  [ 0x18, 0x43 ],
  [ 0x19, 0x00 ],
  [ 0x1a, 0x4b ],
  [ 0x32, 0x09 ],
  [ 0x4f, 0xca ],
  [ 0x50, 0xa8 ],
  [ 0x5a, 0x23 ],
  [ 0x6d, 0x00 ],
  [ 0x39, 0x12 ],
  [ 0x35, 0xda ],
  [ 0x22, 0x1a ],
  [ 0x37, 0xc3 ],
  [ 0x23, 0x00 ],
  [ 0x34, 0xc0 ],
  [ 0x36, 0x1a ],
  [ 0x06, 0x88 ],
  [ 0x07, 0xc0 ],
  [ 0x0d, 0x87 ],
  [ 0x0e, 0x41 ],
  [ 0x4c, 0x00 ],
  [ 0xff, 0x00 ],
  [ 0xe0, 0x04 ],
  [ 0xc0, 0x64 ],
  [ 0xc1, 0x4b ],
  [ 0x86, 0x35 ],
  [ 0x50, 0x92 ],
  [ 0x51, 0xc8 ],
  [ 0x52, 0x96 ],
  [ 0x53, 0x00 ],
  [ 0x54, 0x00 ],
  [ 0x55, 0x00 ],
  [ 0x57, 0x00 ],
  [ 0x5a, 0x2c ],
  [ 0x5b, 0x24 ],
  [ 0x5c, 0x00 ],
  [ 0xe0, 0x00 ],
  [ 0xff, 0xff ],
]

OV2640_320x240_JPEG=[
  [ 0xff, 0x01 ],
  [ 0x12, 0x40 ],
  [ 0x17, 0x11 ],
  [ 0x18, 0x43 ],
  [ 0x19, 0x00 ],
  [ 0x1a, 0x4b ],
  [ 0x32, 0x09 ],
  [ 0x4f, 0xca ],
  [ 0x50, 0xa8 ],
  [ 0x5a, 0x23 ],
  [ 0x6d, 0x00 ],
  [ 0x39, 0x12 ],
  [ 0x35, 0xda ],
  [ 0x22, 0x1a ],
  [ 0x37, 0xc3 ],
  [ 0x23, 0x00 ],
  [ 0x34, 0xc0 ],
  [ 0x36, 0x1a ],
  [ 0x06, 0x88 ],
  [ 0x07, 0xc0 ],
  [ 0x0d, 0x87 ],
  [ 0x0e, 0x41 ],
  [ 0x4c, 0x00 ],
  [ 0xff, 0x00 ],
  [ 0xe0, 0x04 ],
  [ 0xc0, 0x64 ],
  [ 0xc1, 0x4b ],
  [ 0x86, 0x35 ],
  [ 0x50, 0x89 ],
  [ 0x51, 0xc8 ],
  [ 0x52, 0x96 ],
  [ 0x53, 0x00 ],
  [ 0x54, 0x00 ],
  [ 0x55, 0x00 ],
  [ 0x57, 0x00 ],
  [ 0x5a, 0x50 ],
  [ 0x5b, 0x3c ],
  [ 0x5c, 0x00 ],
  [ 0xe0, 0x00 ],
  [ 0xff, 0xff ],
]

OV2640_352x288_JPEG=[
  [ 0xff, 0x01 ],
  [ 0x12, 0x40 ],
  [ 0x17, 0x11 ],
  [ 0x18, 0x43 ],
  [ 0x19, 0x00 ],
  [ 0x1a, 0x4b ],
  [ 0x32, 0x09 ],
  [ 0x4f, 0xca ],
  [ 0x50, 0xa8 ],
  [ 0x5a, 0x23 ],
  [ 0x6d, 0x00 ],
  [ 0x39, 0x12 ],
  [ 0x35, 0xda ],
  [ 0x22, 0x1a ],
  [ 0x37, 0xc3 ],
  [ 0x23, 0x00 ],
  [ 0x34, 0xc0 ],
  [ 0x36, 0x1a ],
  [ 0x06, 0x88 ],
  [ 0x07, 0xc0 ],
  [ 0x0d, 0x87 ],
  [ 0x0e, 0x41 ],
  [ 0x4c, 0x00 ],
  [ 0xff, 0x00 ],
  [ 0xe0, 0x04 ],
  [ 0xc0, 0x64 ],
  [ 0xc1, 0x4b ],
  [ 0x86, 0x35 ],
  [ 0x50, 0x89 ],
  [ 0x51, 0xc8 ],
  [ 0x52, 0x96 ],
  [ 0x53, 0x00 ],
  [ 0x54, 0x00 ],
  [ 0x55, 0x00 ],
  [ 0x57, 0x00 ],
  [ 0x5a, 0x58 ],
  [ 0x5b, 0x48 ],
  [ 0x5c, 0x00 ],
  [ 0xe0, 0x00 ],  
  [ 0xff, 0xff ],
]

OV2640_640x480_JPEG=[
    [0xff, 0x01],
    [0x11, 0x01],
    [0x12, 0x00],
    [0x17, 0x11], 
    [0x18, 0x75], 
    [0x32, 0x36], 
    [0x19, 0x01], 
    [0x1a, 0x97], 
    [0x03, 0x0f], 
    [0x37, 0x40],
    [0x4f, 0xbb],
    [0x50, 0x9c],
    [0x5a, 0x57],
    [0x6d, 0x80],
    [0x3d, 0x34],
    [0x39, 0x02],
    [0x35, 0x88],
    [0x22, 0x0a],
    [0x37, 0x40],
    [0x34, 0xa0],
    [0x06, 0x02],
    [0x0d, 0xb7],
    [0x0e, 0x01],   
    [0xff, 0x00],             
    [0xe0, 0x04],       
    [0xc0, 0xc8],       
    [0xc1, 0x96],       
    [0x86, 0x3d],       
    [0x50, 0x89],       
    [0x51, 0x90],       
    [0x52, 0x2c],       
    [0x53, 0x00],       
    [0x54, 0x00],       
    [0x55, 0x88],       
    [0x57, 0x00],       
    [0x5a, 0xa0],       
    [0x5b, 0x78],       
    [0x5c, 0x00],       
    [0xd3, 0x04],       
    [0xe0, 0x00],                             
    [0xff, 0xff],
]     
    
OV2640_800x600_JPEG=[
    [0xff, 0x01],
    [0x11, 0x01],
    [0x12, 0x00], 
    [0x17, 0x11], 
    [0x18, 0x75], 
    [0x32, 0x36],
    [0x19, 0x01],
    [0x1a, 0x97], 
    [0x03, 0x0f], 
    [0x37, 0x40],
    [0x4f, 0xbb],
    [0x50, 0x9c],
    [0x5a, 0x57],
    [0x6d, 0x80],
    [0x3d, 0x34],
    [0x39, 0x02],
    [0x35, 0x88],
    [0x22, 0x0a],
    [0x37, 0x40],
    [0x34, 0xa0],
    [0x06, 0x02],
    [0x0d, 0xb7],
    [0x0e, 0x01],   
    [0xff, 0x00],
    [0xe0, 0x04],
    [0xc0, 0xc8],
    [0xc1, 0x96],
    [0x86, 0x35],
    [0x50, 0x89],
    [0x51, 0x90],
    [0x52, 0x2c],
    [0x53, 0x00],
    [0x54, 0x00],
    [0x55, 0x88],
    [0x57, 0x00],
    [0x5a, 0xc8],
    [0x5b, 0x96],
    [0x5c, 0x00],
    [0xd3, 0x02],
    [0xe0, 0x00],                      
    [0xff, 0xff],
]     
       
OV2640_1024x768_JPEG=[
    [0xff, 0x01],
    [0x11, 0x01],
    [0x12, 0x00],
    [0x17, 0x11], 
    [0x18, 0x75], 
    [0x32, 0x36], 
    [0x19, 0x01], 
    [0x1a, 0x97],
    [0x03, 0x0f], 
    [0x37, 0x40],
    [0x4f, 0xbb],
    [0x50, 0x9c],
    [0x5a, 0x57],
    [0x6d, 0x80],
    [0x3d, 0x34],
    [0x39, 0x02],
    [0x35, 0x88],
    [0x22, 0x0a],
    [0x37, 0x40],
    [0x34, 0xa0],
    [0x06, 0x02],
    [0x0d, 0xb7],
    [0x0e, 0x01],   
    [0xff, 0x00],         
    [0xc0, 0xC8],          
    [0xc1, 0x96],          
    [0x8c, 0x00],          
    [0x86, 0x3D],          
    [0x50, 0x00],          
    [0x51, 0x90],          
    [0x52, 0x2C],          
    [0x53, 0x00],          
    [0x54, 0x00],          
    [0x55, 0x88],          
    [0x5a, 0x00],          
    [0x5b, 0xC0],          
    [0x5c, 0x01],          
    [0xd3, 0x02],                                
    [0xff, 0xff],
]  


OV2640_1280x1024_JPEG=[
    [0xff, 0x01],
    [0x11, 0x01],
    [0x12, 0x00], 
    [0x17, 0x11], 
    [0x18, 0x75], 
    [0x32, 0x36], 
    [0x19, 0x01], 
    [0x1a, 0x97], 
    [0x03, 0x0f], 
    [0x37, 0x40],
    [0x4f, 0xbb],
    [0x50, 0x9c],
    [0x5a, 0x57],
    [0x6d, 0x80],
    [0x3d, 0x34],
    [0x39, 0x02],
    [0x35, 0x88],
    [0x22, 0x0a],
    [0x37, 0x40],
    [0x34, 0xa0],
    [0x06, 0x02],
    [0x0d, 0xb7],
    [0x0e, 0x01],   
    [0xff, 0x00],                 
    [0xe0, 0x04],           
    [0xc0, 0xc8],           
    [0xc1, 0x96],           
    [0x86, 0x3d],           
    [0x50, 0x00],           
    [0x51, 0x90],           
    [0x52, 0x2c],           
    [0x53, 0x00],           
    [0x54, 0x00],           
    [0x55, 0x88],           
    [0x57, 0x00],           
    [0x5a, 0x40],           
    [0x5b, 0xf0],           
    [0x5c, 0x01],           
    [0xd3, 0x02],           
    [0xe0, 0x00],                                 
    [0xff, 0xff],
]         
       

OV2640_1600x1200_JPEG=[
    [0xff, 0x01],
    [0x11, 0x01],
    [0x12, 0x00], 
    [0x17, 0x11], 
    [0x18, 0x75], 
    [0x32, 0x36], 
    [0x19, 0x01], 
    [0x1a, 0x97], 
    [0x03, 0x0f], 
    [0x37, 0x40],
    [0x4f, 0xbb],
    [0x50, 0x9c],
    [0x5a, 0x57],
    [0x6d, 0x80],
    [0x3d, 0x34],
    [0x39, 0x02],
    [0x35, 0x88],
    [0x22, 0x0a],
    [0x37, 0x40],
    [0x34, 0xa0],
    [0x06, 0x02],
    [0x0d, 0xb7],
    [0x0e, 0x01],
    [0xff, 0x00],                                     
    [0xe0, 0x04],                                   
    [0xc0, 0xc8],                                   
    [0xc1, 0x96],                                   
    [0x86, 0x3d],                                   
    [0x50, 0x00],                                   
    [0x51, 0x90],                                   
    [0x52, 0x2c],                                   
    [0x53, 0x00],                                   
    [0x54, 0x00],                                   
    [0x55, 0x88],                                   
    [0x57, 0x00],                                   
    [0x5a, 0x90],                                   
    [0x5b, 0x2C],                                   
    [0x5c, 0x05],              
    [0xd3, 0x02],                                   
    [0xe0, 0x00],                                                         
    [0xff, 0xff], 
]  

終わり

初投稿の記事ですので読みにくいところや、マナー違反等があるかもしれませんが、その時は教えて下さい。また、何かご質問等があればとりあえず聞いてみてください。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?