Coder Social home page Coder Social logo

m5cloud's Introduction

M5Stack Web IDE

EN | 中文 | 日本語

Contents

Getting Started

1. Burn firmware

Download firmware

https://github.com/m5stack/M5Cloud/tree/master/firmwares

MacOS/Linux

  • Installing esptool:

    pip install esptool

  • Erase flash: esptool.py --chip esp32 --port /dev/tty.SLAB_USBtoUART erase_flash

  • Flash: esptool.py --chip esp32 --port /dev/tty.SLAB_USBtoUART write_flash --flash_mode dio -z 0x1000 firmware.bin

Windows

Windows can use Espressif Flash Download Tools(Download) (Erase first): image

2. Configure the WiFi

  • Connecting M5Stack AP: image

    Connect the WiFi:

    image

  • Use Mobile Phone or PC browser login 192.168.4.1 setting the SSID and Password. image

3. Binding device

Login: http://io.m5stack.com register account and add the device:

image

Input the Check Code for the M5Stack screen display,Check Code is random,after 60s will refresh.

image

image

4. Coding

image

MicroPython API

Micropython Getting Started

LCD


Import M5Stack:

from m5stack import lcd
lcd.print('hello world!')

Colors

Color value are given as 24 bit integer numbers, 8-bit per color.

For example: 0xFF0000 represents the RED color. Only upper 6 bits of the color component value is used.

The following color constants are defined and can be used as color arguments:

BLACK, NAVY, DARKGREEN, DARKCYAN, MAROON, PURPLE, OLIVE, LIGHTGREY, DARKGREY, BLUE, GREEN, CYAN, RED, MAGENTA, YELLOW, WHITE, ORANGE, GREENYELLOW, PINK

Drawing

All drawings coordinates are relative to the display window.

Initialy, the display window is set to full screen, and there are methods to set the window to the part of the full screen.

Fonts

9 bit-mapped fornts and one vector 7-segment font are included. Unlimited number of fonts from file can also be used.

The following font constants are defined and can be used as font arguments:

FONT_Default, FONT_DefaultSmall, FONT_DejaVu18, FONT_Dejavu24, FONT_Ubuntu, FONT_Comic, FONT_Minya, FONT_Tooney, FONT_Small, FONT_7seg


Methods

lcd.pixel(x, y [,color])

Draw the pixel at position (x,y).
If color is not given, current foreground color is used.

lcd.readPixel(x, y)

Get the pixel color value at position (x,y).

lcd.line(x, y, x1, y1 [,color])

Draw the line from point (x,y) to point (x1,y1)
If color is not given, current foreground color is used.

lcd.lineByAngle(x, y, start, length, angle [,color])

Draw the line from point (x,y) with length lenght starting st distance start from center.
If color is not given, current foreground color is used.
The angle is given in degrees (0~359).

lcd.triangle(x, y, x1, y1, x2, y2 [,color, fillcolor])

Draw the triangel between points (x,y), (x1,y1) and (x2,y2).
If color is not given, current foreground color is used.
If fillcolor is given, filled triangle will be drawn.

lcd.circle(x, y, r [,color, fillcolor])

Draw the circle with center at (x,y) and radius r.
If color is not given, current foreground color is used.
If fillcolor is given, filled circle will be drawn.

lcd.ellipse(x, y, rx, ry [opt, color, fillcolor])

Draw the circle with center at (x,y) and radius r.
If color is not given, current foreground color is used.
*opt argument defines the ellipse segment to be drawn, default id 15, all ellipse segments.

Multiple segments can drawn, combine (logical or) the values.

  • 1 - upper left segment
  • 2 - upper right segment
  • 4 - lower left segment
  • 8 - lower right segment

If fillcolor is given, filled elipse will be drawn.

lcd.arc(x, y, r, thick, start, end [color, fillcolor])

Draw the arc with center at (x,y) and radius r, starting at angle start and ending at angle end
The thicknes of the arc outline is set by the thick argument
If fillcolor is given, filled arc will be drawn.

lcd.poly(x, y, r, sides, thick, [color, fillcolor, rotate])

Draw the polygon with center at (x,y) and radius r, with number of sides sides
The thicknes of the polygon outline is set by the thick argument
If fillcolor is given, filled polygon will be drawn.
If rotate is given, the polygon is rotated by the given angle (0~359)

lcd.rect(x, y, width, height, [color, fillcolor])

Draw the rectangle from the upper left point at (x,y) and width width and height height
If fillcolor is given, filled rectangle will be drawn.

lcd.roundrect(x, y, width, height, r [color, fillcolor])

Draw the rectangle with rounded corners from the upper left point at (x,y) and width width and height height
Corner radius is given by r argument.
If fillcolor is given, filled rectangle will be drawn.

lcd.clear([color])

Clear the screen with default background color or specific color if given.

lcd.clearWin([color])

Clear the current display window with default background color or specific color if given.

lcd.orient(orient)

Set the display orientation.
Use one of predifined constants:
lcd.PORTRAIT, lcd.LANDSCAPE, lcd.PORTRAIT_FLIP, lcd.LANDSCAPE_FLIP

lcd.font(font [,rotate, transparent, fixedwidth, dist, width, outline, color])

Set the active font and its characteristics.

Argument Description
font required, use font name constant or font file name
rotate optional, set font rotation angle (0~360)
transparent only draw font's foreground pixels
fixedwidth draw proportional font with fixed character width, max character width from the font is used
dist only for 7-seg font, the distance between bars
width only for 7-seg font, the width of the bar
outline only for 7-seg font, draw the outline
color font color, if not given the current foreground color is used

lcd.attrib7seg(dist, width, outline, color)

Set characteristics of the 7-segment font

Argument Description
dist the distance between bars
width the width of the bar
outline outline color
color fill color

lcd.fontSize()

Return width and height of the active font

lcd.print(text[,x, y, color, rotate, transparent, fixedwidth, wrap])

Display the string text at possition (x,y).
If color is not given, current foreground color is used.

  • x: horizontal position of the upper left point in pixels, special values can be given:
    • CENTER, centers the text
    • RIGHT, right justifies the text
    • LASTX, continues from last X position; offset can be used: LASTX+n
  • y: vertical position of the upper left point in pixels, special values can be given:
    • CENTER, centers the text
    • BOTTOM, bottom justifies the text
    • LASTY, continues from last Y position; offset can be used: LASTY+n
  • text: string to be displayed. Two special characters are allowed in strings:
    • ‘\r’ CR (0x0D), clears the display to EOL
    • ‘\n’ LF (ox0A), continues to the new line, x=0

lcd.text(x, y, text [, color])

Display the string text at possition (x,y).
If color is not given, current foreground color is used.

  • x: horizontal position of the upper left point in pixels, special values can be given:
    • CENTER, centers the text
    • RIGHT, right justifies the text
    • LASTX, continues from last X position; offset can be used: LASTX+n
  • y: vertical position of the upper left point in pixels, special values can be given:
    • CENTER, centers the text
    • BOTTOM, bottom justifies the text
    • LASTY, continues from last Y position; offset can be used: LASTY+n
  • text: string to be displayed. Two special characters are allowed in strings:
    • ‘\r’ CR (0x0D), clears the display to EOL
    • ‘\n’ LF (ox0A), continues to the new line, x=0

lcd.textWidth(text)

Return the width of the string text using the active font fontSize

lcd.textClear(x, y, text [, color])

Clear the the screen area used by string text at possition (x,y) using the bacckground color color.
If color is not given, current background color is used.

lcd.image(x, y, file [,scale, type])

Display the image from the file file on position (x,y)

  • JPG and BMP can be displayed.
  • Constants lcd.CENTER, lcd.BOTTOM, lcd.RIGHT can be used for x&y
  • x and y values can be negative

scale (jpg): image scale factor: 0 to 3; if scale>0, image is scaled by factor 1/(2^scale) (1/2, 1/4 or 1/8)
scale (bmp): image scale factor: 0 to 7; if scale>0, image is scaled by factor 1/(scale+1)
type: optional, set the image type, constants lcd.JPG or lcd.BMP can be used. If not set, file extension and/or file content will be used to determine the image type.

lcd.setwin(x, y, x1, y1)

Set active display window to screen rectangle (x,y) - (x1,y1)

lcd.resetwin()

Reset active display window to full screen size.

lcd.savewin()

Save active display window dimensions.

lcd.restorewin()

Restore active display window dimensions previously saved wint savewin().

lcd.screensize()

Return the display size, (width, height)

lcd.winsize()

Return the active display window size, (width, height)

lcd.hsb2rgb(hue, saturation, brightness)

Converts the components of a color, as specified by the HSB model, to an equivalent set of values for the default RGB model.
Returns 24-bit integer value suitable to be used as color argiment

Arguments

  • hue: float: any number, the floor of this number is subtracted from it to create a fraction between 0 and 1. This fractional number is then multiplied by 360 to produce the hue angle in the HSB color model.
  • saturation: float; 0 ~ 1.0
  • brightness: float; 0 ~ 1.0

lcd.compileFont(file_name [,debug])

Compile the source font file (must have .c extension) to the binary font file (same name, .fon extension) which can be used as external font.
If debug=True the information about compiled font will be printed.

You can create the c source file from any tft font using the included ttf2c_vc2003.exe program. See README for instructions.

Button


Method

buttonA.isPressed()
buttonA.isReleased()
buttonA.pressedFor(timeout)

# if set the callback param, it will interrupt callback function
# or if not set param it will return result at once
buttonA.wasPressed(callback=None) 
buttonA.wasReleased(callback=None)
buttonA.releasedFor(timeout, callback=None)

Example

Loop:

from m5stack import *
import utime

while True:
  if buttonA.wasPressed():
    lcd.print('Button A was Pressed\n')

  if buttonA.wasReleased():
    lcd.print('Button A was Released\n')

  if buttonA.pressedFor(1.5):
    lcd.print('Button A pressed for 1.5s\n')

  if buttonA.releasedFor(2):
    lcd.print('Button A released for 2s press hold\n')
    
  utime.sleep(0.1)

Callback:

from m5stack import *

def on_wasPressed():
  lcd.print('Button B was Pressed\n')

def on_wasReleased():
  lcd.print('Button B was Released\n')

def on_releasedFor():
  lcd.print('Button B released for 1.2s press hold\n')
  
buttonB.wasPressed(on_wasPressed)
buttonB.wasReleased(on_wasReleased)
buttonB.releasedFor(1.2, on_releasedFor)

SD Card


import uos

uos.mountsd()
uos.listdir('/sd')

Speaker


from m5stack import *

speaker.volume(2)
speaker.tone(freq=1800)
speaker.tone(freq=1800, duration=200) # Non-blocking

GPIO


import machine

pinout = machine.Pin(0, machine.Pin.OUT)
pinout.value(1)

pinin = machine.Pin(2, machine.Pin.IN)
val = pinin.value()

PWM


pwm = machine.PWM(pin [, freq=f] [, duty=d] [, timer=tm]) pwm.init([ freq=f] [, duty=d] [, timer=tm])

Arg Description
pin esp32 GPIO number to be used as pwm output
can be given as integer value or machine.Pin object
freq optional, default 5 kHz; pwm frequeny in Hz (1 - 40000000)
duty optional, default 50% kHz; pwm duty cycle in % (0 - 100)
timer optional, default 0; pwm timer (0 - 3)

PWM channel is selected automatically from 8 available pwm channels.

import machine
pwm = machine.PWM(26)
pwm.freq(5000)
pwm.duty(66) # 0.0 ~ 100.0

ADC


import machine

adc = machine.ADC(35)
adc.read()

DAC


import machine

dac = machine.DAC(machine.Pin(26))
dac.write(128)

I2C


from machine import I2C

i2c = I2C(freq=400000, sda=21, scl=22)
                                # create I2C peripheral at frequency of 400kHz
                                # depending on the port, extra parameters may be required
                                # to select the peripheral and/or pins to use

i2c.scan()                      # scan for slaves, returning a list of 7-bit addresses

i2c.writeto(42, b'123')         # write 3 bytes to slave with 7-bit address 42
i2c.readfrom(42, 4)             # read 4 bytes from slave with 7-bit address 42

i2c.readfrom_mem(42, 8, 3)      # read 3 bytes from memory of slave 42,
                                #   starting at memory-address 8 in the slave
i2c.writeto_mem(42, 2, b'\x10') # write 1 byte to memory of slave 42
                                #   starting at address 2 in the slave

SPI


from machine import SPI, Pin

spi = SPI(
    spihost=SPI.HSPI, 
    baudrate=2600000
    sck=Pin(18), 
    mosi=Pin(23), 
    miso=Pin(19), 
    cs=Pin(4)
)

spi.write(buf) #NOHEAP
spi.read(nbytes, *, write=0x00) #write is the byte to ?output on MOSI for each byte read in
spi.readinto(buf, *, write=0x00) #NOHEAP
spi.write_readinto(write_buf, read_buf) #NOHEAP; write_buf and read_buf can be the same

UART


from machine import UART

uart2 = UART(2, tx=17, rx=16)
uart2.init(115200, bits=8, parity=None, stop=1)
uart2.read(10)       # read 10 characters, returns a bytes object
uart2.read()         # read all available characters
uart2.readline()     # read a line
uart2.readinto(buf)  # read and store into the given buffer
uart2.write('abc')   # write the 3 characters

Timer


tm = machine.Timer(timer_no)

timer_no argument is the timer number to be used for the timer. It can be 0 - 3 for 4 hardware timers or 4 - 11 for extended timers. If extended timer is selected, timer 0 must already be configured in EXTBASE mode.

import machine

tcounter = 0

p1 = machine.Pin(27)
p1.init(p1.OUT)
p1.value(1)

def tcb(timer):
    global tcounter
    if tcounter & 1:
        p1.value(0)
    else:
        p1.value(1)
    tcounter += 1
    if (tcounter % 10000) == 0:
        print("[tcb] timer: {} counter: {}".format(timer.timernum(), tcounter))

t1 = machine.Timer(2)
t1.init(period=20, mode=t1.PERIODIC, callback=tcb)

Neopixel


import machine, time

np = machine.Neopixel(machine.Pin(22), 24)

def rainbow(loops=120, delay=1, sat=1.0, bri=0.2):
    for pos in range(0, loops):
        for i in range(0, 24):
            dHue = 360.0/24*(pos+i);
            hue = dHue % 360;
            np.setHSB(i, hue, sat, bri, 1, False)
        np.show()
        if delay > 0:
            time.sleep_ms(delay)

def blinkRainbow(loops=10, delay=250):
    for pos in range(0, loops):
        for i in range(0, 24):
            dHue = 360.0/24*(pos+i);
            hue = dHue % 360;
            np.setHSB(i, hue, 1.0, 0.1, 1, False)
        np.show()
        time.sleep_ms(delay)
        np.clear()
        time.sleep_ms(delay)

RTC


import machine
import utime

rtc = machine.RTC()
rtc.ntp_sync(server="hr.pool.ntp.org", tz="CET-1CEST")
rtc.synced()
True
utime.gmtime()
(2018, 1, 29, 16, 3, 18, 2, 29)
utime.localtime()
(2018, 1, 29, 17, 3, 30, 2, 29)

Boot Modes

Safe boot

After reset, if Button A is held, this will indicate the execution of main.py will be skipped.


M5stack firwmre is base on MicroPython_ESP32_psRAM_LoBo More docs: https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo/wiki

m5cloud's People

Contributors

0x1abin avatar m5stackjimmylai avatar mcauser avatar suzukiken avatar weifuzhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

m5cloud's Issues

lcd.print and lcd.font morecomplex examples

Hello!
I'm trying to get transparent text.
But getting: TypeError: extra positional arguments given
My code is: lcd.font(lcd.FONT_Ubuntu, 0, 1)
Pleas provide more complex example of lcd.print and lcd.font functions with all the arguments.

I do not want my code to be uploaded to the cloud!

I do not want my code to be uploaded to the cloud!!!
I want to keep certain code private.

I am extremely uncomfortable with sending my code or WiFi password to some cloud server.
Certain details of my code projects are strictly private.

Is there a way to still use M5Stack's MicroPython firmware/libraries whilst circumventing the cloud?
I prefer to program over a USB cable.

Please, provide firmware to allow the transfer of MicroPython programs over an USB cable without the need to connect to any WLAN.

Crash on initialize UART

Hello

I tested m5cluod firmware with micropython. The device crashed when initializing UART.
Reproduce this issue in different firmware that are m5cloud-psram-20180419-v0.3.9.bin and m5cloud-psram-20180516-v0.4.0.bin.

Hardware: M5Stack Fire
GPS: M5Stack GPS module

MicroPython ESP32_LoBo_v3.2.11 - 2018-04-16 on M5Stack with ESP32
Type "help()" for more information.
>>> UART(2, tx=17, rx=16)
UART(2, baudrate=115942, bits=8, parity=None, stop=1, tx=17, rx=16, rts=-1, cts=-1, timeout=0, buf_size=512, lineend=b'\r\n')
     Event task minimum free stack: 560
>>> Guru Meditation Error: Core  1 panic'ed (StoreProhibited)
. Exception was unhandled.
Core 1 register dump:
PC      : 0x4008fa45  PS      : 0x00060733  A0      : 0x8008f14a  A1      : 0x3ffd3310
A2      : 0x0000004d  A3      : 0x00060720  A4      : 0x00000001  A5      : 0x0000abab
A6      : 0xb33fffff  A7      : 0x00000000  A8      : 0x0000cdcd  A9      : 0x3ffd3310
A10     : 0x0000abab  A11     : 0x00060723  A12     : 0x00060720  A13     : 0x3f4050f2
A14     : 0x000000fe  A15     : 0x00000001  SAR     : 0x00000018  EXCCAUSE: 0x0000001d
EXCVADDR: 0x0000004d  LBEG    : 0x40098398  LEND    : 0x400983a3  LCOUNT  : 0x00000000

Backtrace: 0x4008fa45:0x3ffd3310 0x4008f147:0x3ffd3340 0x400ffdfe:0x3ffd3380

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:4648
load:0x40078000,len:0
ho 12 tail 0 room 4
load:0x40078000,len:12144
entry 0x40078e0c

Internal FS (SPIFFS): Mounted on partition 'internalfs' [size: 2293760; Flash address: 0x1D0000]
----------------
Filesystem size: 2100992 B
           Used: 35072 B
           Free: 2065920 B
----------------

Device ID:840d8e258fe0
I (1909) wifi: wifi firmware version: 2fc15c0
I (1909) wifi: config NVS flash: enabled
I (1909) wifi: config nano formating: disabled
I (1919) wifi: Init dynamic tx buffer num: 16
I (1919) wifi: Init data frame dynamic rx buffer num: 16
I (1919) wifi: Init management frame dynamic rx buffer num: 16
I (1923) wifi: wifi driver task: 3ffc9c3c, prio:23, stack:4096
I (1928) wifi: Init static rx buffer num: 8
I (1932) wifi: Init dynamic rx buffer num: 16
I (5214) wifi: mode : sta (84:0d:8e:25:8f:e0)
Connect WiFi: SSID:XXXXXX PASSWD:XXXXXXXXX network...
I (5380) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1
.I (6066) wifi: state: init -> auth (b0)
I (6070) wifi: state: auth -> assoc (0)
I (6075) wifi: state: assoc -> run (10)
I (6090) wifi: connected with tsumug, channel 1
I (6091) wifi: pm start, type: 1

...
Connected. Network config: ('192.168.180.21', '255.255.255.0', '192.168.180.1', '118.238.201.33')
Synchronize time from NTP server ...
Traceback (most recent call last):
  File "main.py", line 14, in <module>
NameError: name 'uart2' is not defined

FreeRTOS running on BOTH CORES, MicroPython task started on App Core.
Running from Factory partition starting at 0x10000, [MicroPython].

 Reset reason: Soft CPU reset
    uPY stack: 19456 bytes
     uPY heap: 3073664/29888/3043776 bytes (in SPIRAM using heap_caps_malloc)

MicroPython ESP32_LoBo_v3.2.11 - 2018-04-16 on M5Stack with ESP32
Type "help()" for more information.

Guru meditation error

Hello. Im trying upload firmware from m5cloud to Fire. After press button upload File rebooted and i see it in console

Guru Meditation Error: Core 1 panic'ed (LoadProhibited)
. Exception was unhandled.
Core 1 register dump:
PC : 0x40113ee8 PS : 0x00060430 A0 : 0x80114212 A1 : 0x3ffc4a50
A2 : 0x3f815570 A3 : 0x00000004 A4 : 0x000003c1 A5 : 0x00000002
A6 : 0x00000002 A7 : 0x3ffc4bc0 A8 : 0x80113ee8 A9 : 0x3ffc4a30
A10 : 0x00000000 A11 : 0x7fffffff A12 : 0x80090267 A13 : 0x3ffc4960
A14 : 0x00000003 A15 : 0x00060023 SAR : 0x00000002 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000030 LBEG : 0x4009a1e0 LEND : 0x4009a1eb LCOUNT : 0x00000000

Backtrace: 0x40113ee8:0x3ffc4a50 0x4011420f:0x3ffc4a70 0x400fa6d3:0x3ffc4aa0 0x4011421d:0x3ffc4ac0 0x400ef0b1:0x3ffc4af0 0x400ead19:0x3ffc4b10 0x400ead5d:0x3ffc4b30 0x400ebc5c:0x3ffc4b60 0x400e3360:0x3ffc4be0 0x400fd141:0x3ffc4c30 0x400f5620:0x3ffc4c70 0x400ef186:0x3ffc4c90 0x400ead19:0x3ffc4cc0 0x400ead81:0x3ffc4ce0 0x4008574e:0x3ffc4d00 0x400ef210:0x3ffc4da0 0x400ead19:0x3ffc4e20 0x400ead81:0x3ffc4e40 0x4008574e:0x3ffc4e60 0x400ef210:0x3ffc4f00 0x400ead19:0x3ffc4f80 0x400ead81:0x3ffc4fa0 0x4008574e:0x3ffc4fc0 0x400ef210:0x3ffc5060 0x400ead19:0x3ffc50d0 0x400ead5d:0x3ffc50f0 0x400ebc5c:0x3ffc5120 0x400ec0c1:0x3ffc51a0 0x40085bef:0x3ffc51e0 0x400ef210:0x3ffc5280 0x400ead19:0x3ffc52f0 0x400856bb:0x3ffc5310 0x400ef210:0x3ffc53b0 0x400ead19:0x3ffc5430 0x400ead46:0x3ffc5450 0x400dfc70:0x3ffc5470 0x400dff05:0x3ffc5520 0x400d524b:0x3ffc5540

Rebooting...

Only Fire without modules.
Firmware m5cloud-psram-20180516-v0.4.0.bin

I can download the firmware if I do these steps:

  • Reboot File with A button. (safe mode)
  • Open m5cloud and wait while files uploaded from Fire (i see all files from cloud)
  • Delete _main.py
  • Upload code from m5cloud button.

ampy support

Any plans to ampy support?
I'm getig white screen, then reboot.

lcd.screensize() returns (320, 320)

Firmware: m5cloud-20180102-v0.2.5.bin

LCD's catalog spec is 2.0 inch TFT-LCD 320x240, but
MicroPython API lcd.screensize() returns (320, 320).

MicroPython ESP32_LoBo_v2.0.8 - 2017-11-04 on M5Stack with ESP32
Type "help()" for more information.
>>> from m5stack import lcd
>>> lcd.screensize()
(320, 320)

Is ADC working?

I tried the following script.
But we can only see strange values.

from m5stack import *
from machine import *

p35 = Pin(35,Pin.IN)
adc = ADC(p35)

adc.read()

The value does not become 0 even if it connects with GND, and the value is fluctuating wherever it connects

source code for python libraries

I would like to use the python bindings (e.g. from m5stack import *)
used in the examples with the standard micropython
Where can I find the source code for these?

How to write 16mb filesystem firmware

How to write 16mb filesystem firmware?

I am using a m5Stack fire with 16mb flash and 4mb ram.

At booting i become in repl

Internal FS (SPIFFS): Mounted on partition 'internalfs' [size: 2293760; Flash address: 0x1D0000]

Filesystem size: 2100992 B
Used: 11776 B
Free: 2089216 B

thats 2mb, where are the other 14mb

How can i use or mount them?

Mounting SD card disables display

I found that when I mount the SD card it works fine but lcd functions are no longer displayed.
This happens silently with no errors. I suspect SPI conflict?

BTCTicker Example with Button

Dear friends,

I´m trying to add a button feature with the BTCTicker example, however I having some trouble on it.

When I add the If button... the program stucks at the begining.

Perhaps it is some behavior I don´t understand when using timers (like in btcticker) and button (wich is actually an interruption).

May someone help me on that?

Thanks

Problem with sd flash

Problem with sd flush.
SD flash 2GB

import uos
uos.mountsd()
uos.listdir('/')

;31mE (746707) sdmmc_cmd: sdmmc_card_init: sdio_reset: unexpected return: 0x102m
;31mE (746708) vfs_native: Failed to initialize SDcard (258).m
Traceback (most recent call last):
File "", line 3, in
OSError: [Errno 5] EIO

After Flashing m5cloud-20180516-v0.4.0.bin M5Stack won't turn on

Newbie here. my first time to flash M5Stack. I did follow all the instructions here, and was able to flash (Erase and Flash) successfully (i saw the green button saying Finished), but after i disconnected the USB and try to turn-on it won't turn on.

any help will be greatly appreciated.

Default faces example failing due to invalid syntax.

Using firmware 0.2.5 on a grey (non 4MB PSRAM) M5Stack I see the following when using micro python, and the example faces code:

Connect WiFi: SSID:<redacted> PASSWD:<redacted> network...
..............
Connected. Network config: ('192.168.0.27', '255.255.255.0', '192.168.0.1', '209.18.47.61')
Synchronize time from NTP server ...
Device ID:30aea449bdac
Connecting M5Cloud Server....Connected!
Traceback (most recent call last):
  File "main.py", line 2, in <module>
  File "faces.py", line 18
SyntaxError: invalid syntax

FreeRTOS running on BOTH CORES, MicroPython task started on App Core.

 Reset reason: Power on reset
    uPY stack: 19456 bytes
     uPY heap: 80000/12400/67600 bytes

MicroPython ESP32_LoBo_v2.0.8 - 2017-11-04 on M5Stack with ESP32
Type "help()" for more information.

Lile sync no connexion

Hello,
my m5Stack does not connect to M5Cloud.
I only have sync and kidney files.

Can we use M5cloud offline and how
thank you

Stuck at "Synchronize time from NTP server" with latest firmware m5cloud-psram-20180419-v0.3.9.bin

Hello,

Until today I was using m5cloud-psram-20180323-v0.3.8.bin, worked ok.
I tried to update to m5cloud-psram-20180419-v0.3.9.bin, flash erased and reflashed successfully, wifi configuration successful but then it gets stuck on "Synchronize time from NTP server".

I tried to flash it twice including erase and I tried 3 different wifi networks.

With v0.3.8 it works.

Is v0.3.8 based on master of https://github.com/tuupola/micropython-m5stack or some unreleased code?

I noticed loboris made a new release, when can we expect this to be updated on that?

thanks

Wifi doesnt connect after IDE flash

Hi just getting started .. I was able to down load the firmware into my M5STACK and connect to my e WIFI - I was then able to register the device and then sync the demo IDE files. However even though the WIFI password appeared in the config.json file and I could see it loading on the M5STACK display, the WIFI couldn't connect. I tried this several times and with several versions of the firmware. What am I doing wrong? Is there an error in this config.json statement?
{"wifi": {"ssid": "myssid", "password": "mywifipassword"}}

By the way one more small typo:
When the Check Code acknowledgment text comes up on the M5STACK it reads:
"You device is registered" not "Your device is registered"

Thanks for any help. Dave S

Battery level

Hello!
Is it possible to measure battery level with python?

FrameBuffer object

Please implement a FrameBuffer object from micropython to be able show images from binary buffer? not only file.

Example esptool.py command doesn't specify --flash_mode dio

Current README.md has teh following CLI example for flashing M5Cloud:
esptool.py --chip esp32 --port /dev/tty.SLAB_USBtoUART write_flash -z 0x1000 firmware.bin

Flashing suceeds with this, but the device then fails to boot.
ESP32 has to be flashed in dual IO mode (DIO) - see https://github.com/espressif/esptool

This version has been tested/works on MacOS:
esptool.py --chip esp32 --port /dev/tty.SLAB_USBtoUART write_flash --flash_mode dio -z 0x1000 firmware.bin

lcd.readPixel always returns 0xffffff

Firmware: m5cloud-20180102-v0.2.5.bin

MicroPython API lcd.readPixel() always returns 0xffffff in point within screen size.

MicroPython ESP32_LoBo_v2.0.8 - 2017-11-04 on M5Stack with ESP32
Type "help()" for more information.
>>> from m5stack import lcd
>>> lcd.clear()
>>> lcd.screensize()
(320, 320)
>>> hex(lcd.readPixel(0,0))
'0xffffff'
>>> hex(lcd.readPixel(100,100))
'0xffffff'
>>> hex(lcd.readPixel(319,319))
'0xffffff'
>>> hex(lcd.readPixel(320,320))
'0x0'

Typo in API Readme

There is a typo in the API Readme:
lcd.clearWin([color])
should be
lcd.clearwin([color])

base64

Dear fellows,

Is there any lib to encode / decode base64 ?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.