Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
en:iot-open:getting_familiar_with_your_hardware_rtu_itmo_sut:raspberrypi_rpi:drivers_and_driving [2019/02/18 17:23]
Agrisnik
en:iot-open:getting_familiar_with_your_hardware_rtu_itmo_sut:raspberrypi_rpi:drivers_and_driving [2019/03/12 20:57] (current)
oleg
Line 50: Line 50:
 GPIO.setwarnings(False) GPIO.setwarnings(False)
 GPIO.setup(LED,​GPIO.OUT) GPIO.setup(LED,​GPIO.OUT)
-print "LED on"+print ("LED on")
 GPIO.output(LED,​GPIO.HIGH) GPIO.output(LED,​GPIO.HIGH)
 time.sleep(1) time.sleep(1)
-print "LED off"+print ("LED off")
 GPIO.output(LED,​GPIO.LOW) GPIO.output(LED,​GPIO.LOW)
 </​code>​ </​code>​
Line 168: Line 168:
 from EPD_driver import EPD_driver from EPD_driver import EPD_driver
 def handler(signum,​ frame): def handler(signum,​ frame):
-    print '​SIGTERM'​+    print ('​SIGTERM'​)
     sys.exit(0)     sys.exit(0)
 signal.signal(signal.SIGTERM,​ handler) signal.signal(signal.SIGTERM,​ handler)
Line 174: Line 174:
 device = 0 device = 0
 disp = EPD_driver(spi = SPI.SpiDev(bus,​ device)) disp = EPD_driver(spi = SPI.SpiDev(bus,​ device))
-print "disp size : %dx%d"​%(disp.xDot,​ disp.yDot) +print ("disp size : %dx%d"​%(disp.xDot,​ disp.yDot)
-print '​------------init and Clear full screen------------'​+print ('​------------init and Clear full screen------------'​)
 disp.Dis_Clear_full() disp.Dis_Clear_full()
 disp.delay() disp.delay()
Line 205: Line 205:
               pass               pass
     else:     else:
-      print req.status_code+      print (req.status_code)
 # font for drawing within PIL # font for drawing within PIL
 myfont10 = ImageFont.truetype("​amiga_forever/​amiga4ever.ttf",​ 8) myfont10 = ImageFont.truetype("​amiga_forever/​amiga4ever.ttf",​ 8)
Line 216: Line 216:
 while 1: while 1:
   for name2 in imagenames:   for name2 in imagenames:
-    print '​---------------------'​+    print ('​---------------------'​)
     skip = (skip+1)%7     skip = (skip+1)%7
     try:     try:
Line 225: Line 225:
         name = ("​images/​downloaded.png",​ name2[1])         name = ("​images/​downloaded.png",​ name2[1])
         im = Image.open(name[0])         im = Image.open(name[0])
-        print name, im.format, im.size, im.mode+        print (name, im.format, im.size, im.mode)
         im.thumbnail((296,​128))         im.thumbnail((296,​128))
         im = im.convert("​1"​) #, dither=Image.NONE)         im = im.convert("​1"​) #, dither=Image.NONE)
-        # print '​thumbnail',​ im.format, im.size, im.mode+        # print ('​thumbnail',​ im.format, im.size, im.mode)
         loadtime = time.time()         loadtime = time.time()
-        print '​t:​load+resize:',​ (loadtime - starttime)+        print ('​t:​load+resize:',​ (loadtime - starttime))
         draw = ImageDraw.Draw(mainimg)         draw = ImageDraw.Draw(mainimg)
         # clear         # clear
Line 237: Line 237:
         ypos = (disp.xDot - im.size[1])/​2         ypos = (disp.xDot - im.size[1])/​2
         xpos = (disp.yDot - im.size[0])/​2         xpos = (disp.yDot - im.size[0])/​2
-        print '​ypos:',​ ypos, '​xpos:',​ xpos+        print ('​ypos:',​ ypos, '​xpos:',​ xpos)
         mainimg.paste(im,​ (xpos,​ypos))         mainimg.paste(im,​ (xpos,​ypos))
         # draw info text         # draw info text
Line 246: Line 246:
         for y in range(0, divs):         for y in range(0, divs):
           newtext = name[1][(oldy+1)*len(name[1])/​divs:​(y+1)*len(name[1])/​divs]           newtext = name[1][(oldy+1)*len(name[1])/​divs:​(y+1)*len(name[1])/​divs]
-          # print divs, oldy, y, newtext+          # print (divs, oldy, y, newtext)
           oldy = y           oldy = y
           draw.text((1,​ 1+y*tsy), newtext, fill=255, font=myfont10)           draw.text((1,​ 1+y*tsy), newtext, fill=255, font=myfont10)
Line 271: Line 271:
             im = mainimg.transpose(Image.ROTATE_90)             im = mainimg.transpose(Image.ROTATE_90)
             drawtime = time.time()             drawtime = time.time()
-            print '​t:​draw:',​ (drawtime - loadtime)+            print ('​t:​draw:',​ (drawtime - loadtime))
             listim = list(im.getdata())             listim = list(im.getdata())
-            # print im.format, im.size, im.mode, len(listim)+            # print (im.format, im.size, im.mode, len(listim))
             listim2 = []             listim2 = []
             for y in range(0, im.size[1]):​             for y in range(0, im.size[1]):​
Line 280: Line 280:
                 for x8 in range(0, 8):                 for x8 in range(0, 8):
                   if listim[(im.size[1]-y-1)*im.size[0] + x*8 + (7-x8)] > 128:                   if listim[(im.size[1]-y-1)*im.size[0] + x*8 + (7-x8)] > 128:
-                    # print x,​y,​x8,'​ON'​+                    # print (x,​y,​x8,'​ON'​)
                     val = val | 0x01 << x8                     val = val | 0x01 << x8
                   else:                   else:
-                    # print x,​y,​x8,'​OFF'​+                    # print (x,​y,​x8,'​OFF'​)
                     pass                     pass
                     # print val                     # print val
Line 291: Line 291:
             # print len(listim2)             # print len(listim2)
             convtime = time.time()             convtime = time.time()
-            print '​t:​conv:',​ (convtime - loadtime)+            print ('​t:​conv:',​ (convtime - loadtime))
             ypos = 0             ypos = 0
             xpos = 0             xpos = 0
Line 298: Line 298:
             # disp.delay()             # disp.delay()
             uploadtime = time.time()             uploadtime = time.time()
-            print '​t:​upload:',​ (uploadtime - loadtime)+            print ('​t:​upload:',​ (uploadtime - loadtime))
         except IOError as ex:         except IOError as ex:
-          print '​IOError',​ str(ex)</p>+          print ('​IOError',​ str(ex))
 </​code>​ </​code>​
  
Line 330: Line 330:
 GPIO.setwarnings(False) GPIO.setwarnings(False)
 GPIO.setup(REL,​GPIO.OUT) GPIO.setup(REL,​GPIO.OUT)
-print "REL on"+print ("REL on")
 GPIO.output(REL,​GPIO.HIGH) GPIO.output(REL,​GPIO.HIGH)
 time.sleep(1) time.sleep(1)
-print "REL off"+print ("REL off")
 GPIO.output(REL,​GPIO.LOW) GPIO.output(REL,​GPIO.LOW)
 </​code>​ </​code>​
Line 364: Line 364:
 GPIO.setwarnings(False) GPIO.setwarnings(False)
 GPIO.setup(SOL,​GPIO.OUT) GPIO.setup(SOL,​GPIO.OUT)
-print "SOL on"+print ("SOL on")
 GPIO.output(SOL,​GPIO.HIGH) GPIO.output(SOL,​GPIO.HIGH)
 time.sleep(1) time.sleep(1)
-print "SOL off"+print ("SOL off")
 GPIO.output(SOL,​GPIO.LOW) GPIO.output(SOL,​GPIO.LOW)
 </​code>​ </​code>​
Line 397: Line 397:
 GPIO.setwarnings(False) GPIO.setwarnings(False)
 GPIO.setup(DCM,​GPIO.OUT) GPIO.setup(DCM,​GPIO.OUT)
-print "DCM on"+print ("DCM on")
 GPIO.output(DCM,​GPIO.HIGH) GPIO.output(DCM,​GPIO.HIGH)
 time.sleep(1) time.sleep(1)
-print "DCM off"+print ("DCM off")
 GPIO.output(DCM,​GPIO.LOW) GPIO.output(DCM,​GPIO.LOW)
 </​code>​ </​code>​
en/iot-open/getting_familiar_with_your_hardware_rtu_itmo_sut/raspberrypi_rpi/drivers_and_driving.txt · Last modified: 2019/03/12 20:57 by oleg
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0