Exemple #1
0
 def __init__(self,
              width,
              height,
              spi,
              dc,
              reset,
              cs,
              *,
              external_vcc=False,
              baudrate=8000000,
              polarity=0,
              phase=0):
     self.rate = 10 * 1024 * 1024
     dc.switch_to_output(value=0)
     cs.switch_to_output(value=1)
     self.spi_bus = spi
     self.spi_bus.try_lock()
     self.spi_bus.configure(baudrate=baudrate,
                            polarity=polarity,
                            phase=phase)
     self.spi_bus.unlock()
     self.dc_pin = dc
     self.buffer = bytearray((height // 8) * width)
     framebuffer = framebuf.FrameBuffer1(self.buffer, width, height)
     super().__init__(framebuffer, width, height, external_vcc, reset)
Exemple #2
0
def plot(datos):
    import framebuf
    spi = SPI(1, baudrate=328125, polarity=0, phase=0)
    cs = Pin(2) #D4
    dc = Pin(15) #D8
    rst = Pin(0) #D3
    #bl = Pin(12, Pin.OUT, value=1) #D6
    print("Variables:OK")
    lcd = pcd8544.PCD8544(spi, cs, dc, rst)
    print("lcd ok")
    buffer = bytearray((lcd.height // 8) * lcd.width)
    framebuf = framebuf.FrameBuffer1(buffer, lcd.width, lcd.height)
    framebuf.fill(1)
    lcd.data(buffer)
    time.sleep(1)
    framebuf.fill(0)
    lcd.data(buffer)

    for i,y in zip(range(84),datos):
        print(i, " {" ,round(y), "} ")
        time.sleep_ms(40)
        framebuf.pixel(i,round(y),1)
    #eje y
    #print(save)
    framebuf.vline(0, 0, 96, 0xffff)
    #eje x
    framebuf.hline(0, 24, 96, 0xffff)
    #escribiendo datas
    lcd.data(buffer)
Exemple #3
0
    def __init__(self,
                 width,
                 height,
                 i2cBus,
                 address=0x3c,
                 probe=False,
                 lock=None,
                 debug=False,
                 external_vcc=False):
        if not lock:  # I2C sema
            import _thread
            lock = _thread.allocate_lock()

        from i2c_device import I2CDevice
        self._i2c = I2CDevice(i2cBus, address, probe=probe, lock=lock)  #
        self._debug = debug
        self.addr = address

        self.temp = bytearray(2)
        # Add an extra byte to the data buffer to hold an I2C data/command byte
        # to use hardware-compatible I2C transactions.  A memoryview of the
        # buffer is used to mask this byte from the framebuffer operations
        # (without a major memory hit as memoryview doesn't copy to a separate
        # buffer).
        self.buffer = bytearray(((height // 8) * width) + 1)
        self.buffer[0] = 0x40  # Set first byte of data buffer to Co=0, D/C=1
        self.framebuf = framebuf.FrameBuffer1(
            memoryview(self.buffer)[1:], width, height)
        self.pixel = super().pixel
        super().__init__(width, height, external_vcc)
Exemple #4
0
 def __init__(self,
              width,
              height,
              i2c_bus_id,
              addr=0x3c,
              external_vcc=False):
     self.i2c_bus_id = i2c_bus_id
     # print("bus_id 1306: "+str(i2c_bus_id))
     self.addr = addr
     self.temp = bytearray(2)
     # Add an extra byte to the data buffer to hold an I2C data/command byte
     # to use hardware-compatible I2C transactions.  A memoryview of the
     # buffer is used to mask this byte from the framebuffer operations
     # (without a major memory hit as memoryview doesn't copy to a separate
     # buffer).
     self.buffer = bytearray(((height // 8) * width) + 1)
     self.buffer[0] = 0x40  # Set first byte of data buffer to Co=0, D/C=1
     if sys.platform.startswith("esp32"):
         self.framebuf = framebuf.FrameBuffer1(
             memoryview(self.buffer)[1:], width, height)
     else:
         self.framebuf = FrameBuffer(
             memoryview(self.buffer)[1:], width, height)
     super().__init__(width, height, external_vcc)
     self.init_display()
def __init__:
	sckPin = Pin(18)
	mosiPin = Pin(23)
	misoPin = Pin(19)

	spi = SPI(1, baudrate=328125, bits=8, polarity=0, phase=1, sck=sckPin, mosi=mosiPin, miso=misoPin)
	spi.init()

	cs = Pin(2)
	dc = Pin(15)
	rst = Pin(0)

	# backlight on
	bl = Pin(12, Pin.OUT, value=1)

	lcd = pcd8544.PCD8544(spi, cs, dc, rst)
	lcd.contrast(0x3c, pcd8544.BIAS_1_40, pcd8544.TEMP_COEFF_0)
	lcd.reset()
	lcd.init()
	lcd.clear()


	buffer = bytearray((lcd.height // 8) * lcd.width)
	framebuf = framebuf.FrameBuffer1(buffer, lcd.width, lcd.height)

	framebuf.fill(0)
	lcd.data(buffer)
Exemple #6
0
def plotseno(w, phi, amplitud):
    import framebuf
    spi = SPI(1, baudrate=328125, polarity=0, phase=0)
    cs = Pin(2)  #D4
    dc = Pin(15)  #D8
    rst = Pin(0)  #D3
    #bl = Pin(12, Pin.OUT, value=1) #D6
    print("Variables:OK")
    lcd = pcd8544.PCD8544(spi, cs, dc, rst)
    print("lcd ok")
    buffer = bytearray((lcd.height // 8) * lcd.width)
    framebuf = framebuf.FrameBuffer1(buffer, lcd.width, lcd.height)
    framebuf.fill(1)
    lcd.data(buffer)
    time.sleep(1)
    framebuf.fill(0)
    lcd.data(buffer)
    save = []
    for i in range(84):
        y = 24 - amplitud * math.sin((i * w) + phi)
        save.append(y)
        print(i, " {", round(y), "} ", y)
        time.sleep_ms(40)
        framebuf.pixel(i, round(y), 1)
    #eje y
    print(save)
    framebuf.vline(0, 0, 96, 0xffff)
    #eje x
    framebuf.hline(0, 24, 96, 0xffff)
    #escribiendo datas
    lcd.data(buffer)
Exemple #7
0
    def __init__(self,
                 width,
                 height,
                 spi,
                 cs,
                 *,
                 baudrate=8000000,
                 polarity=0,
                 phase=0):

        self._chip_select = cs
        self._chip_select.direction = digitalio.Direction.OUTPUT

        self._spi_device = spi_device.SPIDevice(spi,
                                                cs,
                                                baudrate=baudrate,
                                                polarity=polarity,
                                                phase=phase)

        self._buffer = bytearray((height // 8) * width)
        self.framebuf = framebuf.FrameBuffer1(self._buffer, width, height)

        self.width = width
        self.height = height

        self.init_display()
Exemple #8
0
def initFB():
    global lcd
    global buffer
    global fb
    import framebuf
    print('Init framebuffer')
    buffer = bytearray((lcd.height // 8) * lcd.width)
    fb = framebuf.FrameBuffer1(buffer, lcd.width, lcd.height)
 def __init__(self, width, height, external_vcc):
     self.width = width
     self.height = height
     self.external_vcc = external_vcc
     self.pages = self.height // 8
     self.buffer = bytearray(self.pages * self.width)
     self.framebuf = framebuf.FrameBuffer1(self.buffer, self.width, self.height)
     self.poweron()
     self.init_display()
 def __init__(self, width, height, i2c, addr=0x3c, external_vcc=False):
     self.i2c = i2c
     self.addr = addr
     self.temp = bytearray(2)
     self.buffer = bytearray(((height // 8) * width) + 1)
     self.buffer[0] = 0x40  # Set first byte of data buffer to Co=0, D/C=1
     self.framebuf = framebuf.FrameBuffer1(
         memoryview(self.buffer)[1:], width, height)
     super().__init__(width, height, external_vcc)
Exemple #11
0
 def __init__(self):
     self.spi = SPI(1)
     self.spi.init(baudrate=8000000, polarity=0, phase=0)
     self.cs = Pin(2)
     self.dc = Pin(15)
     self.rst = Pin(0)
     self.bl = Pin(12, Pin.OUT)
     self.lcd = pcd8544.PCD8544(self.spi, self.cs, self.dc, self.rst)
     self.buffer = bytearray((self.lcd.height // 8) * self.lcd.width)
     self.framebuf = framebuf.FrameBuffer1(self.buffer, self.lcd.width, self.lcd.height)
 def __init__(self, width, height, spi, a0, reset, cs, *,
              external_vcc=False, baudrate=20000000, polarity=0, phase=0):
     self.rate = 10 * 1024 * 1024
     a0.switch_to_output(value=0)
     self.spi_device = spi_device.SPIDevice(spi, cs, baudrate=baudrate,
                                            polarity=polarity, phase=phase)
     self.a0_pin = a0
     # self.buffer = bytearray(height * width)
     self.buffer = bytearray((height // 8) * width)
     framebuffer = framebuf.FrameBuffer1(self.buffer, width, height)
     super().__init__(framebuffer, width, height, external_vcc, reset)
 def __init__(self, width, height, spi, dc, res, cs, external_vcc=False):
     self.rate = 10 * 1024 * 1024
     dc.init(dc.OUT, value=0)
     res.init(res.OUT, value=0)
     cs.init(cs.OUT, value=1)
     self.spi = spi
     self.dc = dc
     self.res = res
     self.cs = cs
     self.buffer = bytearray((height // 8) * width)
     self.framebuf = framebuf.FrameBuffer1(self.buffer, width, height)
     super().__init__(width, height, external_vcc)
Exemple #14
0
 def __init__(self, i2c, addr=0x3c):
     self.i2c = i2c
     self.addr = addr
     self.temp = bytearray(2)
     #self.width = 128
     #self.height = height
     #self.external_vcc = external_vcc
     self.pages = 4 #self.height // 8
     self.buffer = bytearray(4 * 128) #self.pages * self.width)
     self.framebuf = framebuf.FrameBuffer1(self.buffer, 128, 32) #self.width, self.height)
     self.poweron()
     self.init_display()
Exemple #15
0
 def __init__(self, width, height, i2c, addr=0x78, external_vcc=False):
     self.i2c = i2c
     self.addr = addr
     self.temp = bytearray(2)
     # Add an extra byte to the data buffer to hold an I2C data/command byte
     # to use hardware-compatible I2C transactions.  A memoryview of the
     # buffer is used to mask this byte from the framebuffer operations
     # (without a major memory hit as memoryview doesn't copy to a separate
     # buffer).
     self.buffer = bytearray(((height // 8) * width) + 1)
     self.buffer[0] = 0x40  # Set first byte of data buffer to Co=0, D/C=1
     self.framebuf = framebuf.FrameBuffer1(memoryview(self.buffer)[1:], width, height)
     super().__init__(width, height, external_vcc)
 def bigchar(self, char):
     if self.display:
         self.display.fill(0)
         if self.charbuffer == None:
             self.charbuffer = framebuf.FrameBuffer1(
                 memoryview(bytearray(8)), 8, 8)
         self.charbuffer.fill(0)
         self.charbuffer.text(char, 0, 0, 1)
         for x in range(0, 8):
             for y in range(0, 8):
                 self.display.fill_rect(8 + x * 6, y * 6, 6, 6,
                                        self.charbuffer.pixel(x, y))
         self.display.show()
Exemple #17
0
 def __init__(self, i2c, height=64, addr=0x3c, external_vcc=False):
     self.i2c = i2c
     self.addr = addr
     self.temp = bytearray(2)
     self.width = 128
     self.height = height
     self.external_vcc = external_vcc
     self.pages = self.height // 8
     self.buffer = bytearray(self.pages * self.width)
     self.framebuf = framebuf.FrameBuffer1(self.buffer, self.width,
                                           self.height)
     self.poweron()
     self.init_display()
Exemple #18
0
 def __init__(self):
     width = 128
     height = 64
     self.buffer = bytearray(((height // 8) * width))
     self._framebuf = framebuf.FrameBuffer1(memoryview(self.buffer), width,
                                            height)
     self.hline = self._framebuf.hline  # 横线     hline(x,y,长度,是否填充[0 or 1])
     self.vline = self._framebuf.vline  # 竖线     hline(x,y,长度,是否填充[0 or 1])
     self.line = self._framebuf.line  # 线段     line(x1,y1,x2,y2,是否填充[0 or 1])
     self.rect = self._framebuf.rect  # 矩形     rect(x1,y1,x2,y2,是否填充[0 or 1])
     self.fill_rect = self._framebuf.fill_rect  # 填充矩形  rect(x1,y1,x2,y2,是否填充[0 or 1])
     self.blit = self._framebuf.blit  # 绘制另外一个帧缓冲区 blit(fbuf, x, y[, key])
     self.scroll = self._framebuf.scroll  # 滚动画面  scroll(dx, dy)
     self.fill = self._framebuf.fill  # 全屏填充  fill( col 是否填充[0 or 1])
Exemple #19
0
 def char(self, char, x, y, color=0xffff, background=0x0000):
     buffer = bytearray(_FONT_SIZE)
     framebuffer = framebuf.FrameBuffer1(buffer, _FONT_SIZE, _FONT_SIZE)
     framebuffer.text(char, 0, 0)
     color = ustruct.pack(">H", color)
     background = ustruct.pack(">H", background)
     data = bytearray(2 * _FONT_SIZE * _FONT_SIZE)
     for c, byte in enumerate(buffer):
         for r in range(_FONT_SIZE):
             if byte & (1 << r):
                 data[r * _FONT_SIZE * 2 + c * 2] = color[0]
                 data[r * _FONT_SIZE * 2 + c * 2 + 1] = color[1]
             else:
                 data[r * _FONT_SIZE * 2 + c * 2] = background[0]
                 data[r * _FONT_SIZE * 2 + c * 2 + 1] = background[1]
     self._block(x, y, x + (_FONT_SIZE - 1), y + (_FONT_SIZE - 1), data)
Exemple #20
0
 def char(self, char, x, y, color=0x0000, background=0xffff):
     buffer = bytearray(8)
     framebuffer = framebuf.FrameBuffer1(buffer, 8, 8)
     framebuffer.text(char, 0, 0)
     color = ustruct.pack(">H", color)
     background = ustruct.pack(">H", background)
     data = bytearray(2 * 8 * 8)
     for c, byte in enumerate(buffer):
         for r in range(8):
             if byte & (1 << r):
                 data[r * 8 * 2 + c * 2] = color[0]
                 data[r * 8 * 2 + c * 2 + 1] = color[1]
             else:
                 data[r * 8 * 2 + c * 2] = background[0]
                 data[r * 8 * 2 + c * 2 + 1] = background[1]
     self._block(x, y, x + 7, y + 7, data)
Exemple #21
0
    def __init__(self, x, y, width, height):
        # crash without is it height if == 2
        width = int(ceil(width / 8.0)) * 8
        height = int(ceil(height / 8.0)) * 8

        self.buffer = bytearray(height * width // 8)
        self.framebuf = framebuf.FrameBuffer1(memoryview(self.buffer), width,
                                              height, framebuf.MONO_HMSB)
        self.framebuf.fill(0)

        self.width = width
        self.height = height

        self.x = x
        self.y = y

        self.pixel_scrolled = 0
        self.needs_reset = False
    def __init__(self, w, h, spi, cs,
                 baudrate=8000000, polarity=0, phase=0):
        """
        :param int w: the number of pixels wide
        :param int h: the number of pixels high
        :param object spi: an spi busio or spi bitbangio object
        :param ~digitalio.DigitalInOut cs: digital in/out to use as chip select signal 
        """
        
        self.cs = cs
        self.cs.direction = digitalio.Direction.OUTPUT
        
        self.spiDevice = spi_device.SPIDevice(spi, cs, baudrate=baudrate,
                                               polarity=polarity, phase=phase)
       
        self.buffer = bytearray((h // 8) * w)
        self.framebuf = framebuf.FrameBuffer1(self.buffer, w, h)

        self.w = w
        self.h = h

        self.init_display()
 def __init__(self,
              width,
              height,
              spi,
              dc,
              res,
              cs,
              cs2,
              external_vcc=False):
     self.rate = 10 * 1024 * 1024
     dc.init(dc.OUT, value=0)
     res.init(res.OUT, value=0)
     cs.init(cs.OUT, value=1)
     cs2.init(cs2.OUT, value=1)  # chip select for KANJI
     self.spi = spi
     self.dc = dc
     self.res = res
     self.cs = cs
     self.cs2 = cs2
     self.buffer = bytearray((height // 8) * width)
     self.framebuf = framebuf.FrameBuffer1(self.buffer, width, height)
     self.matrixdata = bytearray([0 for i in range(32)])
     super().__init__(width, height, external_vcc)
Exemple #24
0
print(buf)
fbuf.scroll(0, -2)
print(buf)
fbuf.scroll(1, 0)
print(buf)
fbuf.scroll(-1, 0)
print(buf)
fbuf.scroll(2, 2)
print(buf)

# print text
fbuf.fill(0)
fbuf.text("hello", 0, 0, 1)
print(buf)
fbuf.text("hello", 0, 0, 0)  # clear
print(buf)

# char out of font range set to chr(127)
fbuf.text(str(chr(31)), 0, 0)
print(buf)

# test invalid constructor
try:
    fbuf = framebuf.FrameBuffer(buf, w, h, 2, framebuf.MVLSB)
except ValueError:
    print("ValueError")

# test legacy constructor
fbuf = framebuf.FrameBuffer1(buf, w, h)
fbuf = framebuf.FrameBuffer1(buf, w, h, w)
Exemple #25
0
CE = Pin(5)
DC = Pin(12)
BL = Pin(16)
lcd = upcd8544.PCD8544(spi, RST, CE, DC, BL)

#lcd.light_on()
#lcd.light_off()

# Use a framebuffer to store the 4032 pixels (84x48):

import framebuf
width = 84
height = 48
pages = height // 8
buffer = bytearray(pages * width)
framebuf = framebuf.FrameBuffer1(buffer, width, height)

# Print Hello, World! using the 8x8 font:

framebuf.text("Hello,", 0, 0, 1)
framebuf.text("World!", 0, 9, 1)
lcd.data(buffer)
sleep(5)


def elTime(sec):
    m, s = divmod(seconds, 60)
    h, m = divmod(m, 60)
    return "%02d:%02d:%02d" % (h, m, s)

Exemple #26
0
# MicroPython SSD1306 OLED driver, I2C and SPI interfaces
from machine import I2C, Pin
rst = Pin(16, Pin.OUT)
rst.value(1)
i2c = I2C(scl=Pin(15, Pin.OUT, Pin.PULL_UP),
          sda=Pin(4, Pin.OUT, Pin.PULL_UP),
          freq=450000)
assert 0x3c in i2c.scan(), "OLED i2c not found"

import framebuf

# There is an extra byte to the data buffer to hold an I2C data/command byte
# to use hardware-compatible I2C transactions.
buffer = bytearray(((64 // 8) * 128) + 1)
buffer[0] = 0x40  # Set first byte of data buffer to Co=0, D/C=1
fbuff = framebuf.FrameBuffer1(memoryview(buffer)[1:], 128, 64)

cmdforinit = bytes((
    0xae,  # CMD_DISP=off
    0x20,
    0x00,  # SET_MEM_ADDR  horizontal
    0x40,  # SET_DISP_START_LINE
    0xa0 | 0x01,  # column addr 127 mapped to SEG0
    0xa8,
    63,  # SET_MUX_RATIO, height-1
    0xc0 | 0x08,  # SET_COM_OUT_DIR scan from COM[N] to COM0
    0xd3,
    0x00,  # SET_DISP_OFFSET
    0xda,
    0x12,  # SET_COM_PIN_CFG
    0xd5,
    0x80,  # SET_DISP_CLK_DIV
Exemple #28
0
#D4 to CE (cs)
#D8 to DC
#D7 to Din
#D5 to Clk
#D6 to BL

bl = Pin(12, Pin.OUT, value=1) #D6
print("Variables:OK")
lcd = pcd8544.PCD8544(spi, cs, dc, rst)
print("lcd ok")
#bl.value(0)
#time.sleep(2)
#bl.value(1)
import framebuf
buffer = bytearray((lcd.height // 8) * lcd.width)
framebuf = framebuf.FrameBuffer1(buffer, lcd.width, lcd.height)
framebuf.fill(1)
lcd.data(buffer)
time.sleep(2)
framebuf.fill(0)
lcd.data(buffer)
#
framebuf.text("Hello,", 0, 0, 1)
framebuf.text("World!", 0, 9, 1)
lcd.data(buffer)
time.sleep(1)
#
#
framebuf.fill(0)
framebuf.text("Bye!", 0, 9, 1)
lcd.data(buffer)
Exemple #29
0
 def __init__(self, i2c, height=64, width=128):
     self.buffer = bytearray(((height // 8) * width) + 1)
     self.buffer[0] = 0x40  # Set first byte of data buffer to Co=0, D/C=1
     self.framebuf = framebuf.FrameBuffer1(
         memoryview(self.buffer)[1:], width, height)
     self.i2c = i2c
     self.ADDR = 0x3C
     cmd64 = [
         [0xAE],  # DISPLAYOFF
         [0xA4],  #显示恢复
         [0xD5, 0xF0],  # 设置显示时钟SETDISPLAYCLOCKDIV
         [0xA8, 0x3F],  # 设置多重 SETMULTIPLEX
         [0xD3, 0x00],  # 设置显示偏移SETDISPLAYOFFSET
         [0 | 0x0],  # 设定起始行 SETSTARTLINE
         [0x8D, 0x14],  # CHARGEPUMP
         [0x20, 0x00],  #  内存模式水平 MEMORYMODE horizontal
         [0x21, 0, 127],  # 列地址 COLUMNADDR
         [0x22, 0, 63],  # 页面地址 PAGEADDR
         [0xa0 | 0x1],  # SEGREMAP
         [0xc8],  #  通讯扫描COMSCANDEC
         [0xDA, 0x12],  #设置组合 SETCOMPINS
         [0x81, 0xCF],  #  SETCONTRAST
         [0xd9, 0xF1],  # SETPRECHARGE
         [0xDB, 0x40],  # SETVCOMDETECT
         [0xA6],  # NORMALDISPLAY
         [0xd6, 0],  # zoom off
     ]
     cmd32 = [
         [0xAE],  # DISPLAYOFF
         [0xD5],  # SETDISPLAYCLOCKDIV
         [0x80],  # the suggested ratio 0x80
         [0xA8],  # SSD1306_SETMULTIPLEX
         [0x1F],
         [0xD3],  # SETDISPLAYOFFSET
         [0x00],  # no offset
         [0x40 | 0x0],  # SETSTARTLINE
         [0x8D],  # CHARGEPUMP
         [0x14],  #0x014 enable, 0x010 disable
         [
             0x20
         ],  #com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5),
         [0x00],  #128x64:0x00     128x32 : 0x02, or 128x32 OLED 0x12  
         [0xa1],  #segment remap a0/a1
         [0xc8],  #c0: scan dir normal, c8: reverse
         [0xda],
         [
             0x02
         ],  #com pin HW config, sequential com pin config (bit 4), disable left/right remap (bit 5)
         [0x81],
         [0xcf],  #[2] set contrast control
         [0xd9],
         [0xf1],  #[2] pre-charge period 0x022/f1
         [0xdb],
         [0x40],  #vcomh deselect level
         [0x2e],  #Disable scroll
         [0xa4],  #output ram to display
         [0xa6],  #none inverted normal display mode
         [0xaf]  #display on
     ]
     cmd = cmd32 if (height == 32) else cmd64
     del cmd32
     del cmd64
     for c in cmd:
         self.command(c)
     self.clear()
     self.command([0xaf])  # SSD1306_DISPLAYON
Exemple #30
0
def urectangular(max, puntos, K, amplitud, w0, phi):
    print("urectangular")

    import framebuf
    spi = SPI(1, baudrate=328125, polarity=0, phase=0)
    cs = Pin(2)  #D4
    dc = Pin(15)  #D8
    rst = Pin(0)  #D3
    #bl = Pin(12, Pin.OUT, value=1) #D6
    print("Variables:OK")
    lcd = pcd8544.PCD8544(spi, cs, dc, rst)
    print("lcd ok")
    buffer = bytearray((lcd.height // 8) * lcd.width)
    framebuf = framebuf.FrameBuffer1(buffer, lcd.width, lcd.height)
    framebuf.fill(1)
    lcd.data(buffer)
    time.sleep(1)
    framebuf.fill(0)
    lcd.data(buffer)

    print("Iniciando...")
    count = 0
    y_record = []  #
    y_res = []
    T = calculadora.ulinspace(max, puntos)

    #print(T)
    for k in range(1, K + 1):
        #print("k -> ",k)
        for t in T:
            #print("Operacion: ", "k -> ",k, ", t -> ",t)
            y = amplitud * (4 / math.pi) * (math.sin(
                ((2 * k - 1) * (w0 * t + phi))) / (2 * k - 1))
            y_record.append(y)  #Lista de puntos de la funcion.
            time.sleep_ms(10)
        count = count + 1
        gc.collect()
        #diseno: esta agregando a la lista ambas funciones.

    #
    print(count, "ok")
    time.sleep(1)
    print("Puntos: ", len(T), ", tamano del arreglo ", len(y_record),
          " presicion: ", K)
    for i in range(puntos):
        #print("Suma: ", i, " con ", i+(K-1)*puntos )
        #time.sleep(0.2)
        y_res.append(y_record[i] + y_record[i + (K - 1) * puntos])
        time.sleep_ms(10)
    K = K - 1

    while K != 1:
        for i in range(puntos):
            #print("Suma while: ", i, " con ", i+(K-1)*puntos )
            #time.sleep(0.2)
            y_res[i] = y_res[i] + y_record[i + (K - 1) * puntos]
            time.sleep_ms(10)
        print("Tamano del arreglo res", len(y_res), "presicion: ", K)
        K = K - 1
    print(len(y_res))

    count = 1
    for y in y_res:
        print(y, round(y))
        time.sleep_ms(10)
        framebuf.pixel(count, 24 - round(y), 1)
        count = count + 1
    #eje y
    framebuf.vline(0, 0, 96, 0xffff)
    #eje x
    framebuf.hline(0, 24, 96, 0xffff)
    #escribiendo datas
    lcd.data(buffer)