Skip to content

Latest commit

 

History

History
39 lines (24 loc) · 1.35 KB

app_speed.rst

File metadata and controls

39 lines (24 loc) · 1.35 KB

3. APP - SPEED

In this project, you can view the speed and mileage of the car's movement on the app.

Quick User Guide

  1. Run the app_3_speed.py file under the pico_4wd_car\examples\app_control path.
  2. Based on app_move, add Gauge and Number widgets to the B and C areas as shown below.

    image

  3. After saving () and connecting () the controller, click to run it.
  4. Now, tap on the D-Pad to control the movement and adjust the power via the Throttle widget. You can also see the speed and mileage from the B and C areas.

How it works?

This project is generally the same as app_move, except that two lines have been added to the on_receive(data) function to send the APP the speed and mileage data.

'''----------------- on_receive (ws.loop()) ---------------------'''
def on_receive(data):
    global throttle_power, steer_power, move_status, dpad_touched

    ''' if not connected, skip & stop '''
    if not ws.is_connected():
        return

    # Speed measurement
    ws.send_dict['B'] = round(speed.get_speed(), 2) # uint: cm/s
    # Speed mileage
    ws.send_dict['C'] = speed.get_mileage() # unit: meter

    # ..........