openUC2 WebSERIAL Demonstration

   OpenUC2 Online Tool

This is to use the Web Serial interface to control a UC2 ESP device

Connect to ESP32

Microscope Webcam Livestream

Timelapse Settings

Set the interval (in milliseconds) and control the timelapse.

Snaps Taken: 0

Hardware Control

Status

Laser

Value: 0

Value: 0

Value: 0

Value: 0

Motor

Rotator

LED

Outer Ring

Middle Ring

Inner Ring

Enable

Connect to PS4 Controller

Baud Rate:
Disconnected

Motor X

Serial Terminal X

Code Examples



          # enable
          {"task":"/motor_act", "isen":1, "isenauto":1}
        # modules

    {"task":"/modules_get"}
    {"task":"/modules_set", "modules" : {"led" : 1, "motor": 1, "slm" : 0, "home":1, "analogin" : 0, "pid" : 0, "laser" : 1, "dac" : 0, "analogout" : 0, "digitalout" : 0, "digitalin" : 1, "scanner" : 0}}
    {"task":"/modules_set", "modules" : {"led" : 0, "motor": 1, "slm" : 0, "home":0, "analogin" : 0, "pid" : 0, "laser" : 0, "dac" : 0, "analogout" : 0, "digitalout" : 0, "digitalin" : 1, "scanner" : 0}}
    {"task":"/state_get"}
    # DAC
    {"task":"/dac_act_fct", "dac_channel":1, "frequency":1000, "offset":0, "amplitude":1}

    # MOTOR
    # X,Y,Z,A => 1,2,3,0
    {"task":"/motor_set",
        "motor":
        {
            "steppers": [
                { "stepperid": 1, "step": 26, "dir": 16, "enable": 12, "step_inverted": 0, "dir_inverted": 0, "enable_inverted": 0 , "min_pos":0, "max_pos":0},
                { "stepperid": 2, "step": 25, "dir": 27, "enable": 12, "step_inverted": 0, "dir_inverted": 0, "enable_inverted": 0 , "min_pos":0, "max_pos":0},
                { "stepperid": 3, "step": 17, "dir": 14, "enable": 12, "step_inverted": 0, "dir_inverted": 0, "enable_inverted": 0 , "min_pos":0, "max_pos":0},
                { "stepperid": 0, "step": 19, "dir": 18, "enable": 12, "step_inverted": 0, "dir_inverted": 0, "enable_inverted": 0 , "min_pos":0, "max_pos":0}
            ]
        }
    }
    {"task":"/motor_set", "isen":0}
    {"task":"/motor_set", "isen":1}
    {"task":"/motor_act",
        "motor":
        {
            "steppers": [
                { "stepperid": 1, "position": 10000, "speed": 5000, "isabs": 0, "isaccel":0},
                { "stepperid": 3, "position": 10000, "speed": 5000, "isabs": 0, "isaccel":0}
            ]
        }
    }
    {"task":"/motor_act",
        "motor":
        {
            "steppers": [
                { "stepperid": 3, "position": -1000, "speed": 1000, "isabs": 0, "isaccel":0}
            ]
        }
    }
    {"task":"/motor_act",
        "motor":
        {
            "steppers": [
                { "stepperid": 3, "isforever": 1, "speed": 2000}
            ]
        }
    }



    # DIGITAL OUT
    // trigger
    {"task":"/digitalout_set", "digitaloutid":1, "digitaloutpin":4}
    {"task":"/digitalout_act", "digitalout1TriggerDelayOn":100, "digitalout1TriggerDelayOff":10, "digitalout1IsTrigger":1,  "digitalout2TriggerDelayOn":10, "digitalout2TriggerDelayOff":100, "digitalout2IsTrigger":1}
    {"task":"/digitalout_act", "digitaloutistriggerreset":1}


    # DIGITAL IN
    {"task": "/digitalin_set", "digitalinid":1, "digitalinpin":13}
    {"task": "/digitalin_set", "digitalinid":2, "digitalinpin":5}
    {"task": "/digitalin_set", "digitalinid":3, "digitalinpin":23}
    {"task": "/digitalin_get", "digitalinid":1}

    {"task": "/digitalin_set", "digitalinid":3, "digitalinpin":34}
    {"task": "/laser_set", "LASERid":1, "LASERpin":18}
    {"task": "/laser_set", "LASERid":2, "LASERpin":19}
    {"task": "/ledarr_set", "led":{"ledArrPin":32, "ledArrNum":64}}


    # LASER
    {"task": "/laser_act", "LASERid":2, "LASERpin":19}
    payload = {
        "task": path,
        "LASERid": channel,
        "LASERval": value,
        "LASERdespeckle": int(value*despeckleAmplitude),
        "LASERdespecklePeriod": int(despecklePeriod),
    }
    {"task": "/laser_act", "LASERid":1, "LASERval": 1024}
    {"task": "/laser_get"}

    # HOME
    {"task": "/home_get"}
    {"task": "/home_set"}
    {"task":"/home_act", "home": {"steppers": [{"stepperid":1, "timeout": 20000, "speed": 15000, "direction":-1, "endposrelease":3000}]}}
    {"task":"/home_act", "home": {"steppers": [{"stepperid":2, "timeout": 20000, "speed": 15000, "direction":-1, "endposrelease":3000}]}}
    {"task":"/home_act", "home": {"steppers": [{"stepperid":3, "timeout": 2000, "speed": 15000, "direction":-1, "endposrelease":3000}]}}


    {"task":"/home_act", "home": {"steppers": [{"stepperid":1, "timeout": 20000, "speed": 15000, "direction":1, "endposrelease":3000}
    {"stepperid":2, "timeout": 20000, "speed": 15000, "direction":1, "endposrelease":3000}]}}





    {"task":"/wifi/scan"}
    {"task":"/wifi/connect","ssid":"Test","PW":"12345678", "AP":false}
    {"task":"/bt_connect", "mac":"1a:2b:3c:01:01:01", "psx":2}


    {"task":"/ledarr_act", "led":{"LEDArrMode":1, "led_array":[{"id":0, "r":0, "g":5, "b":0}]}}
    {"task":"/ledarr_act", "led":{"LEDArrMode":0, "led_array":[{"id":0, "r":0, "g":5, "b":0}]}}

    {"task": "/motor_get"}

    # HOLISHEET
    {"task":"/modules_set", "modules" : {"dac" : 1}}
    {"task": "/laser_act", "LASERid":1, "LASERval": 512}
    {"task":"/dac_act", "dac_channel":1, "frequency":1}
    {"task":"/motor_act",
        "motor":
        {
            "steppers": [
                { "stepperid": 1, "position": -10000, "speed": 15000, "isabs": 0, "isaccel":0},
                { "stepperid": 2, "position": 10000, "speed": 15000, "isabs": 0, "isaccel":0}
            ]
        }
    }




    {"task":"/motor_act",
        "motor":
        {
            "steppers": [
                { "stepperid": 1, "position": -10000, "speed": 15000, "isabs": 0, "isaccel":0, "isen":1},
                { "stepperid": 3, "position": 10000, "speed": 15000, "isabs": 0, "isaccel":0}
            ]
        }
    }

    {"task":"/motor_act",
        "motor":
        {
            "steppers": [
                { "stepperid": 1, "position": -10000, "speed": 15000, "isabs": 0, "isaccel":0, "isen":1}
        ]}}

    {"task":"/motor_act",     "motor":     {         "steppers": [             { "stepperid": 1, "position": -1000, "speed": 2000, "isabs": 0, "isaccel":1, "isen":0, "accel":20000}     ]}}



    {"task":"/home_act", "setpos":1, "home": {"steppers": [{"stepperid":1, "posval": 20000}]}}