{"id":3044,"date":"2023-02-16T23:24:44","date_gmt":"2023-02-16T14:24:44","guid":{"rendered":"https:\/\/www.pinewell.jp\/wordpress\/?p=3044"},"modified":"2023-02-16T23:24:44","modified_gmt":"2023-02-16T14:24:44","slug":"rasberrypi-pico%e3%81%a7%e3%81%ae%e6%b0%b4%e6%b8%a9%e8%a8%88%e4%bd%9c%e6%88%90-%e3%81%9d%e3%81%ae5","status":"publish","type":"post","link":"https:\/\/www.pinewell.jp\/wordpress\/?p=3044","title":{"rendered":"RasberryPi Pico\u3067\u306e\u6c34\u6e29\u8a08\u4f5c\u6210 \u305d\u306e5"},"content":{"rendered":"\n<p>\u524d\u56de\u30a2\u30c3\u30d7\u3057\u305f\u30bd\u30fc\u30b9\u3067\u306fGC9A01\u306b\u8868\u793a\u3055\u305b\u308b\u30d5\u30a9\u30f3\u30c8\u304c\u6c17\u306b\u5165\u3089\u306a\u304b\u3063\u305f\u3002<\/p>\n\n\n\n<p>\u3055\u3089\u306bbitmap\u306e\u8868\u793a\u304c\u3069\u306e\u3088\u3046\u306b\u3057\u305f\u3089\u3088\u3044\u3082\u306e\u304b\u308f\u304b\u3089\u306a\u304b\u3063\u305f\u306e\u3067\u65b0\u305f\u306b\u63a2\u3057\u3066\u307f\u305f\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/russhughes\/gc9a01_mpy\">https:\/\/github.com\/russhughes\/gc9a01_mpy<\/a><\/p>\n\n\n\n<p>\u7d50\u679c\u4e0a\u8a18\u306e\u30b5\u30a4\u30c8\u306b\u884c\u304d\u3064\u304d\u3001jpg\u30d5\u30a1\u30a4\u30eb\u3001.py\u30d5\u30a1\u30a4\u30eb\u3078\u5909\u63db\u3057\u3066\u306ebitmap\u30d5\u30a1\u30a4\u30eb\u306e\u8868\u793a\u65b9\u6cd5\u304c\u5206\u304b\u3063\u305f\u3002<\/p>\n\n\n\n<p>\u3068\u308a\u3042\u3048\u305a\u52d5\u4f5c\u306f\u3059\u308b\u3002\u5b9f\u969b\u306b\u8eca\u8f09\u3057\u305f\u3068\u304d\u306b\u3069\u3046\u306a\u308b\u304b\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">from machine import Pin,SPI,I2C,PWM\nimport gc9a01 # \u5185\u5305\u3055\u308c\u3066\u3044\u308bfirmware\u3092\u4f7f\u3046\u3053\u3068\u3002\nimport onewire, ds18x20\nimport time,utime,math\n\nfrom ds1307 import DS1307 #lib\u30d5\u30a9\u30eb\u30c0\n\nfrom fonts import chango_16 as fontA\nfrom fonts import chango_32 as fontB\n\nimport hondaWing #bitmap\u306epython\u30b9\u30af\u30ea\u30d7\u30c8\n\ndef main():\n    #ini\u30d5\u30a1\u30a4\u30eb\u306e\u4fdd\u5b58\n    def SaveIniFile(filename, dictionary):\n        with open(filename, \"w\") as f:\n            for key in dictionary:\n                f.write(\"{},{}\\n\".format(key, dictionary[key]))\n    #ini\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u53d6\u308a\n    def LoadIniFile(filename):\n        dictionary = {}\n        with open(filename, \"r\") as f:\n            for s in f:\n                lst = s.strip().split(\",\")\n                dictionary[lst[0]] = lst[1]\n        return dictionary\n    #\u4f7f\u3044\u65b9\n    #data = {}\n    #data[\"Name\"] = \"Hippy\"\n    #data[\"Year\"] = \"2021\"\n    #SaveIniFile(\"\/MyData.ini\", data)\n    #data = LoadIniFile(\"\/MyData.ini\")\n    #print(data)\n      \n  \n       \n    #arduino\u306eMAP\u95a2\u6570\n    def convert(x, in_min, in_max, out_min, out_max):\n        return (x - in_min) * (out_max - out_min) \/\/ (in_max - in_min) + out_min\n\n    #\u5186\u3092\u66f8\u3044\u3066\u5857\u308a\u3064\u3076\u3059\n    def circle(x,y,r,c):\n       tft.hline(x-r,y,r*2,c)\n       for i in range(1,r):\n           a = int(math.sqrt(r*r-i*i))#\u5e73\u65b9\u6839\u3060\u3063\u3066\n           tft.hline(x-a,y+i,a*2,c)\n           tft.hline(x-a,y-i,a*2,c)\n    #\u5186\u3092\u66f8\u304f\n    def ring(x,y,r,c):\n        tft.pixel(x-r,y,c)\n        tft.pixel(x+r,y,c)\n        tft.pixel(x,y-r,c)\n        tft.pixel(x,y+r,c)\n        #lcd.display()\n        #utime.sleep(0.1)\n        for i in range(1,r):\n            a = int(math.sqrt(r*r-i*i)) # Pythagoras\n            tft.pixel(x-a,y-i,c)\n            tft.pixel(x+a,y-i,c)\n            tft.pixel(x-a,y+i,c)\n            tft.pixel(x+a,y+i,c)\n            tft.pixel(x-i,y-a,c)\n            tft.pixel(x+i,y-a,c)\n            tft.pixel(x-i,y+a,c)\n            tft.pixel(x+i,y+a,c)\n            \n    data = LoadIniFile(\"ini.ini\")\n    dspMode=data[\"dspMode\"]\n    face=(\"FaceA.jpg\",\"FaceD.jpg\")\n   \n    modePin=21  #\u6642\u523b\u5408\u308f\u305b\u30e2\u30fc\u30c9\u306b\u79fb\u884c\u30b9\u30a4\u30c3\u30c1\n    upPin=20    #\u65e5\u4ed8\u30fb\u6642\u8a08\u3042\u308f\u305b\u306e\u30a2\u30c3\u30d7\u30b9\u30a4\u30c3\u30c1\n\n    cds = machine.ADC(0) #\u660e\u308b\u3055\u30bb\u30f3\u30b5\u30fc GP26\u304cADC0\n    # 16bit\u306e\u6570\u5024\u4e00\u5358\u4f4d\u3067\u306e\u96fb\u5727\u5024\u3092\u8a2d\u5b9a\u3057\u307e\u3059\n    unit = 0.00005035477\n    \n    kurai = 20000  #\u6697\u3044\u3068\u304d\n    akarui = 65535 #\u660e\u308b\u3044\u3068\u304d\n    \n    dspMode = 0  #0:\u30a2\u30ca\u30ed\u30b0 1:\u30c7\u30b8\u30bf\u30eb\n    mode    = 0  #0:\u901a\u5e38 1:\u6642\u8a08\u5408\u308f\u305b \n    sec     = 0  #\u6642\u8a08\u5408\u308f\u305b\u306e\u6642\u306e\u30bb\u30af\u30b7\u30e7\u30f3 0:Year 1:month 2 day 3 hour 4 minute \n    uYear   = 0  #\u6642\u8a08\u3042\u308f\u305b\u3088\u3046\u306e\u5024\n    uMonth  = 0\n    uDate   = 0\n    uHour   = 0\n    uMinute = 0\n\n    epSec = 0\n\n    swMode = machine.Pin(modePin,machine.Pin.IN,machine.Pin.PULL_DOWN) #\u30b9\u30a4\u30c3\u30c1\u306e\u5b9a\u7fa9\n    swUp   = machine.Pin(upPin,machine.Pin.IN,machine.Pin.PULL_DOWN)   #\u30b9\u30a4\u30c3\u30c1\u306e\u5b9a\u7fa9\n\n    pushStart =0 #\u62bc\u3057\u59cb\u3081\u305f\u6642\u9593\n    flgPush = False #\u62bc\u3057\u3066\u3044\u308b\u304b\n    pushInt = 0 #\u62bc\u3055\u308c\u3066\u3044\u305f\u6642\u9593\n\n    DSPIN = 19 #\u6e29\u5ea6\u8a08\u306ePin\u3002onewire\n    dsCnt = 0  #\u6e29\u5ea6\u8a08\u306e\u6570\n    \n    ds_pin = machine.Pin(DSPIN)\n    ds_sensor = ds18x20.DS18X20(onewire.OneWire(ds_pin)) #\u6e29\u5ea6\u8a08\u3092\u5b9a\u7fa9\n    \n    pw33 = machine.Pin(18,machine.Pin.OUT)   #RTC\u306e3.3V\u3092\u5f97\u308b\u305f\u3081\n    pw33.value(1)\n    \n    tokei=True #RTC\u304c\u53d6\u5f97\u3067\u304d\u305f\u304b\u30d5\u30e9\u30b0\n\n\n    try:   #RTC\u304b\u3089\u73fe\u5728\u6642\u523b\u306e\u53d6\u5f97\n      i2c_rtc = I2C(0,scl = Pin(17),sda = Pin(16),freq = 100000) #RTC\u306e\u5b9a\u7fa9\n      result = I2C.scan(i2c_rtc)\n\n      rtc = DS1307(i2c_rtc)\n      (year,month,date,day,hour,minute,second,p1)=rtc.datetime()\n\n      #RTC\u304b\u3089\u53d6\u5f97\u3057\u305f\u6642\u9593\u3092\u5143\u306b 2021\/1\/1 00:00:00(RP2040\u306e\u30ea\u30bb\u30c3\u30c8\u6642\u9593)\u3068\u306e\u5dee\u5206\u3092\u4f5c\u6210\n      epSec = utime.mktime((year,month,date,hour,minute,second,0,0)) #1970\/1\/1 00:00:00\u304b\u3089\u306e\u7d4c\u904e\u79d2\n      epSec = epSec-1609459200\n      \n      if year==2000:#RTC\u304b\u3089\u306e\u521d\u53d6\u5f97\u306f2000\u5e74\u3068\u306a\u308b\u306e\u3067\u305d\u306e\u5834\u5408\u306b 2023\/2\/2 12:00:00\u306bRTC\u3092\u8a2d\u5b9a \n          year = 2023\n          month = 2 \n          date = 2 \n          day = 4 \n          hour = 12\n          minute = 0\n          second = 0\n        \n          now = (year,month,date,day,hour,minute,second,0)\n          rtc.datetime(now)\n    except:\n        print(\"not Tokei\")  #RTC\u304b\u3089\u53d6\u5f97\u3067\u304d\u306a\u304b\u3063\u305f\u3089 tokei\u975e\u8868\u793a\n        tokei=False\n        \n    o_ds = bytearray(b'(\\x07\\x83t\/!\\x01(') #\u6e29\u5ea6\u8a08\u306e\u500b\u4f53\u3092\u7279\u5b9a \u5916\u6c17\u6e29\n    w_ds = bytearray(b'(?\\x9b8\/!\\x01\\xd4') #                \u6c34\u6e29\n    \n    try:\n        roms = ds_sensor.scan()  #\u30bb\u30f3\u30b5\u30fc\u3092\u53d6\u5f97\n        dsCnt=len(roms)          #\u30bb\u30f3\u30b5\u30fc\u6570\u3092\u5f97\u308b\n        for rom in roms:\n            print('Found DS devices: ', rom)\n    except:\n        dsCnt = 0\n    \n    #\u6db2\u6676\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u306e\u5b9a\u7fa9\n    spi = SPI(1, baudrate=60000000, sck=Pin(10), mosi=Pin(11))\n        \n    tft = gc9a01.GC9A01(#\u30d0\u30c3\u30af\u30e9\u30a4\u30c8\u306fPWM\u3067\u8abf\u6574\u3059\u308b\u306e\u3067\u6307\u5b9a\u3057\u306a\u3044\u3002\n        spi,\n        240,\n        240,\n        reset=Pin(12, Pin.OUT),\n        cs=Pin(9, Pin.OUT),\n        dc=Pin(8, Pin.OUT),\n        rotation=0)\n\n    #\u30d0\u30c3\u30af\u30e9\u30a4\u30c8\u306fPWM\u3067\u8abf\u6574\n    pwm = PWM(Pin(25))\n    pwm.freq(1000)\n    pwm.duty_u16(akarui)\n    tft.init()\n    \n    tft.jpg(face[dspMode], 0, 0, gc9a01.SLOW)\n    \n    oldx =120\n    oldy = 120\n    \n    \n    while True:\n        for i in range(100): #\u30d0\u30c3\u30af\u30e9\u30a4\u30c8\u306e\u660e\u308b\u3055\u8abf\u6574\n            # ADC\u306e\u5024\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3059(16bit\u306e\u751f\u306e\u6570\u5024)\n            voltRaw = cds.read_u16()\n            #print(\"voltRaw:\" + str(voltRaw))\n            volt = voltRaw * unit\n            #print( \"volt:\" + \"{:.3f}\".format(volt))\n        if volt &gt; 2:\n            pwm.duty_u16(kurai)\n        else:\n            pwm.duty_u16(akarui)\n \n        #\u30e2\u30fc\u30c9\u30b9\u30a4\u30c3\u30c1\u304c\u62bc\u3055\u308c\u3066\u3044\u308b\u304b\uff1f\n        if swMode.value() == 1:\n            if flgPush : #\u9577\u62bc\u4e2d\n                pushInt = utime.time()-pushStart\n            else:\n                flgPush = True #\u9577\u62bc\u3057\u8a08\u6e2c\u30b9\u30bf\u30fc\u30c8\n                pushStart = utime.time()\n                pushInt = 0\n        else:\n            if flgPush :# \u3059\u3067\u306b\u62bc\u3055\u308c\u3066\u3044\u3066\u96e2\u3057\u305f\n                flgPush=False\n                pushInt=utime.time()-pushStart #\u62bc\u3057\u3066\u3044\u305f\u6642\u9593\u3092\u53d6\u5f97\n                if pushInt &gt; 2: #\u9577\u62bc\u3057\u3055\u308c\u305f\n                    #print(\"long\") \n                    if mode ==0: #\u6642\u8a08\u5408\u308f\u305b\u30e2\u30fc\u30c9\u306b\u79fb\u884c\n                        tft.fill(gc9a01.WHITE)\n                        (uYear,uMonth,uDate,day,uHour,uMinute,second,p1)=rtc.datetime() #\n                        mode=1\n                        sec=0\n                    else:   #\u6642\u8a08\u5408\u308f\u305b\u30e2\u30fc\u30c9\u3067\u9577\u62bc\u3057\n                        if sec == 4:#\u5206\u307e\u3067\u8a2d\u5b9a\u3057\u3066\u305f\u3089\u6642\u8a08\u5408\u308f\u305b\u7d42\u4e86\n                            now = (uYear,uMonth,uDate,0,uHour,uMinute,0,0)\n                            rtc.datetime(now)\n                            sec=0\n                            mode=0\n                            tft.fill(gc9a01.WHITE)\n                            tft.jpg(face[dspMode], 0, 0, gc9a01.SLOW)\n                            oldx=120\n                            oldy=120\n                        else:#\u6b21\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3078\u79fb\u884c\n                            sec=sec+1\n                else:\n                    print(\"short\") #\u77ed\u62bc\u3057\u306f\u8868\u793a\u30e2\u30fc\u30c9\u5207\u308a\u66ff\u3048\n        #\u8abf\u6574\u7528UP\u30dc\u30bf\u30f3\u306e\u51e6\u7406\n        if swUp.value() == 1:\n            #print(\"up\")\n            if tokei : #\u6642\u8a08\u8868\u793a\u304c\u3067\u304d\u308b\u3002 \n                if mode == 1: #\u6642\u523b\u8abf\u6574\u30e2\u30fc\u30c9\n                    utime.sleep_ms(200)        \n                    if sec ==0:\n                        uYear=uYear+1\n                        if uYear&gt;2100:\n                            uYear=2023\n                    elif sec ==1:\n                        uMonth=uMonth+1\n                        if uMonth&gt;12:\n                            uMonth=1\n                    elif sec ==2:\n                        uDate=uDate+1\n                        if uDate&gt;31:\n                            uDate=1\n                    elif sec ==3:\n                        uHour=uHour+1\n                        if uHour&gt;23:\n                            uHour=0\n                    elif sec ==4:\n                        uMinute=uMinute+1\n                        if uMinute&gt;59:\n                            uMinute=0\n                else :\n                    #\u6642\u523b\u8a2d\u5b9a\u30e2\u30fc\u30c9\u3058\u3083\u7121\u3044\u5834\u5408\u306f\u8868\u793a\u30e2\u30fc\u30c9\u5207\u308a\u66ff\u3048\n                    if dspMode==0:\n                        dspMode=1\n                        tft.jpg(face[dspMode], 0, 0, gc9a01.SLOW)\n                        data[\"dspMode\"] = dspMode\n                        SaveIniFile(\"\/ini.ini\", data)\n                    else:\n                        dspMode=0\n                        data[\"dspMode\"] = dspMode\n                        SaveIniFile(\"\/ini.ini\", data)\n                        tft.jpg(face[dspMode], 0, 0, gc9a01.SLOW)\n                        oldx=120\n                        oldy=120\n                        \n                #print(str(uYear)+\"\/\"+str(uMonth)+\"\/\"+str(uDate) + \"  \" + str(uHour)+\":\"+str(uMinute)+\":00\")\n\n        \n        if mode ==0: #\u901a\u5e38\u8868\u793a\n            #\u6e29\u5ea6\u306e\u53d6\u5f97\n            oTemp = 999.99\n            wTemp = 999.99\n            oReadErr=\"\"\n            wReadErr=\"\"\n            if dsCnt &gt; 0 :#\u6e29\u5ea6\u8a08\u306e\u6570\u304c0\u4ee5\u4e0a\u3060\u3063\u305f\u3089\n                flgSuc=True\n                try:\n                    ds_sensor.convert_temp()\n                    utime.sleep_ms(750)\n                except:\n                    flgSuc=False\n                if flgSuc:\n                    for rom in roms:\n                        if rom == o_ds :\n                            buf = oTemp\n                            try:\n                                oTemp = ds_sensor.read_temp(rom)\n                                oReadErr=\"O\"\n                            except:\n                                oReadErr=\"X\"\n                                oTemp=buf\n                        else :\n                            buf = wTemp\n                            try:\n                                wTemp = ds_sensor.read_temp(rom)\n                                wReadErr=\"O\"\n                            except:\n                                wReadErr=\"X\"\n                                wTemp=buf\n            \n            if dspMode==0:\n                wwTemp = 20 #\u6700\u5c0f\u6e29\u5ea6            \n                if wTemp &lt;=120 or wTemp &gt; 20: #\u8aad\u307f\u53d6\u308c\u3066\u3044\u308b\uff1f\n                    wwTemp = wTemp\n        \n                kakudo = convert(wwTemp,20,120,40,320) #\u89d2\u5ea6\u3092\u53d6\u5f97\n                rad = 3.14*kakudo\/180 #\u30e9\u30b8\u30a2\u30f3\u5024\u306b\u5909\u63db\n                r=90  #\u91dd\u306e\u9577\u3055\n                x = int(r*(math.cos(rad))) + 120 #\u5ea7\u6a19\u3092\u6c42\u3081\u308b\n                y = int(r*(math.sin(rad))) + 120 \n\n                c=gc9a01.BLACK\n                if wTemp &gt;80:\n                    c=gc9a01.RED\n                elif wTemp&lt;40:\n                    c=gc9a01.BLUE\n            \n                tft.write(fontA, \"w={:.1f}  \".format(wTemp),150,105,c,gc9a01.WHITE)\n                tft.write(fontA, \"o={:.1f}  \".format(oTemp),155,120,gc9a01.BLACK,gc9a01.WHITE)\n        \n                if (x != oldx) or (y !=oldy) :\n                  tft.line(122, 120 ,oldx ,oldy, gc9a01.WHITE)\n                  tft.line(121, 121 ,oldx ,oldy, gc9a01.WHITE)\n                  tft.line(120, 120, oldx, oldy, gc9a01.WHITE)\n                  tft.line(120, 119 ,oldx ,oldy, gc9a01.WHITE)\n                  tft.line(120, 121, oldx, oldy, gc9a01.WHITE)\n                  tft.line(119, 119 ,oldx ,oldy, gc9a01.WHITE)\n                  tft.line(119, 120 ,oldx ,oldy, gc9a01.WHITE)\n                  tft.line(118, 120 ,oldx ,oldy, gc9a01.WHITE)\n                  tft.line(120, 118 ,oldx ,oldy, gc9a01.WHITE)\n\n                  tft.write(fontA, \"20\",175, 162,gc9a01.BLACK,gc9a01.WHITE)\n                  tft.write(fontA, \"40\",94, 190,gc9a01.BLACK,gc9a01.WHITE)\n                  tft.write(fontA, \"60\",40, 148,gc9a01.BLACK,gc9a01.WHITE)\n                  tft.write(fontA, \"80\",40, 77,gc9a01.BLACK,gc9a01.WHITE)\n                  tft.write(fontA, \"100\",94, 31,gc9a01.BLACK,gc9a01.WHITE)\n                  tft.write(fontA, \"120\",175, 61,gc9a01.BLACK,gc9a01.WHITE)\n                  tft.bitmap(hondaWing,120-int(hondaWing.WIDTH\/2),50)\n          \n                  tft.line(122, 120 ,x ,y, gc9a01.RED)\n                  tft.line(121, 121 ,x ,y, gc9a01.RED)\n                  tft.line(120, 120, x, y, gc9a01.RED)\n                  tft.line(120, 119 ,x ,y, gc9a01.RED)\n                  tft.line(120, 121, x, y, gc9a01.RED)\n                  tft.line(119, 119 ,x ,y, gc9a01.RED)\n                  tft.line(119, 120 ,x ,y, gc9a01.RED)\n                  tft.line(118, 120 ,x ,y, gc9a01.RED)\n                  tft.line(120, 118 ,x ,y, gc9a01.RED)\n        \n                  oldx = x\n                  oldy = y\n\n                circle(120,120,10,gc9a01.BLACK)\n            else :\n                # \u6e29\u5ea6\u306e\u8868\u793a \u53f3\u5bc4\u305b\n                tft.write(fontA, \"WaterTemp\",40,68,gc9a01.BLACK,gc9a01.WHITE)\n                w = tft.write_len(fontB,\"    {:.2f}\".format(wTemp))\n                tft.write(fontB, \"    {:.2f}\".format(wTemp),210-w,86,gc9a01.BLACK,gc9a01.WHITE)\n                tft.write(fontA,wReadErr,40,90,gc9a01.BLACK,gc9a01.WHITE)\n                tft.write(fontA, \"OutTemp\",40,128,gc9a01.BLACK,gc9a01.WHITE)\n                w = tft.write_len(fontB,\"    {:.2f}\".format(oTemp))\n                tft.write(fontB, \"    {:.2f}\".format(oTemp),210-w,146,gc9a01.BLACK,gc9a01.WHITE)\n                tft.write(fontA,oReadErr,40,150,gc9a01.BLACK,gc9a01.WHITE)\n\n            if tokei :\n                it = utime.mktime(utime.localtime()) #\u30ed\u30fc\u30ab\u30eb\u3067\u306f 2021\/1\/1 00:00:00\u3068\u3057\u3066\u8d77\u52d5\u3057\u305f1970\/1\/1 00:00:00\u304b\u3089\u306e\u7d4c\u904e\u79d2\n                it = it+epSec                        #RTC\u5dee\u5206\u306e\u5024\u3068\u3042\u308f\u305b\u3066\n                time =   utime.localtime(it)         #\u672c\u5f53\u306e\u73fe\u5728\u6642\u523b\u3092\u751f\u6210\n                year=time[0]\n                month=time[1]\n                date=time[2]\n                hour=time[3]\n                minute=time[4]\n                second=time[5]\n                if dspMode==1:\n                    dateStr = \"{0:04d}\/ {1:02d}\/ {2:02d}  \".format(year,month,date)\n                    tft.write(fontA, dateStr,56, 195,gc9a01.BLACK,gc9a01.WHITE)\n                    tft.write(fontA, \"                \",85, 178,gc9a01.BLACK,gc9a01.WHITE)\n                timeStr = \"{0:02d}:{1:02d}:{2:02d}  \".format(hour,minute,second)\n                tft.write(fontA, timeStr,80, 213,gc9a01.BLACK,gc9a01.WHITE)\n                \n                \n        else: #\u6642\u8a08\u5408\u308f\u305b\n            \n            dateStr = \"{0:04d}\/ {1:02d}\/ {2:02d}  \".format(uYear,uMonth,uDate)\n            tft.write(fontA, dateStr,60, 195,gc9a01.BLACK,gc9a01.WHITE)\n            timeStr = \"{0:02d}:{1:02d}:00      \".format(uHour,uMinute)\n            tft.write(fontA, timeStr,82, 213,gc9a01.BLACK,gc9a01.WHITE)\n            if sec ==0:\n                tft.write(fontA,\"year       \",85, 178,gc9a01.BLACK,gc9a01.WHITE)\n            elif sec ==1:\n                tft.write(fontA,\"month      \",85, 178,gc9a01.BLACK,gc9a01.WHITE)\n            elif sec ==2:\n                tft.write(fontA,\"date       \",85, 178,gc9a01.BLACK,gc9a01.WHITE)\n            elif sec ==3:\n                tft.write(fontA,\"hour       \",85, 178,gc9a01.BLACK,gc9a01.WHITE)\n            elif sec ==4:\n                tft.write(fontA,\"minute \",85, 178,gc9a01.BLACK,gc9a01.WHITE)\n        utime.sleep_ms(10)        \nmain()\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u30a2\u30c3\u30d7\u3057\u305f\u30bd\u30fc\u30b9\u3067\u306fGC9A01\u306b\u8868\u793a\u3055\u305b\u308b\u30d5\u30a9\u30f3\u30c8\u304c\u6c17\u306b\u5165\u3089\u306a\u304b\u3063\u305f\u3002 \u3055\u3089\u306bbitmap\u306e\u8868\u793a\u304c\u3069\u306e\u3088\u3046\u306b\u3057\u305f\u3089\u3088\u3044\u3082\u306e\u304b\u308f\u304b\u3089\u306a\u304b\u3063\u305f\u306e\u3067\u65b0\u305f\u306b\u63a2\u3057\u3066\u307f\u305f\u3002 https:\/\/github.com\/russhug [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-3044","post","type-post","status-publish","format-standard","hentry","category-2"],"views":916,"_links":{"self":[{"href":"https:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3044","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3044"}],"version-history":[{"count":2,"href":"https:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3044\/revisions"}],"predecessor-version":[{"id":3046,"href":"https:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/3044\/revisions\/3046"}],"wp:attachment":[{"href":"https:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3044"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3044"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pinewell.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3044"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}