pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

Atomic Base

UIFlow 1.0 Project

Module GRBL

Example

from m5stack import *
from m5ui import *
from uiflow import *
import module

import time

setScreenColor(0x222222)
grbl = module.get(module.GRBL)

grbl.set_mode("distance")
while True:
  grbl.turn(10, 10, 10, 100)
  wait(5)
  grbl.turn((-10), (-10), (-10), 100)
  wait(5)
  wait_ms(2)

API

grbl.set_mode("distance")
  • Setting the GRBL operating mode:
    • distance:Distance control mode
    • absolute:Absolute position control mode
grbl.turn(10, 10, 10, speed)
  • In distance control mode, the stepper motor is controlled to move a specified distance.
grbl.g_code('')
  • Send GRBL G-code for control.
grbl.wait_idle()
  • Blocking waiting for the motor to stop running
grbl.in_lock()
  • Determines whether the motor is in a locked state.
grbl.lock_motor()
  • Locking at the end of motor operation
grbl.read_idle()
  • Determine whether the motor is idle or not
grbl.read_line()
  • Read GRBL control return information
grbl.unlock()
  • Unlock motor lock state after limit trigger
grbl.unlock_motor()
  • No locking after the motor has finished running
grbl.read_clean()
  • Clear GRBL return data message
On This Page