Asssitance Required: Code cannot work

Hi Support,

When I ran the code below on the GoPiGo3;

import time
import easygopigo3 as easy

gpg = easy.EasyGoPiGo3

my_distance_sensor=gpg.init_distance_sensor()

while True
print("Distance Sensor Reading(mm) : " + str(my_distance_sensor.read_mm()))

The error I got is as below:

TypeError:init() got an unexpected keyword argument

Try this:

import time
import easygopigo3 as easy

gpg = easy.EasyGoPiGo3()

my_distance_sensor = gpg.init_distance_sensor()

while True :
    print("Distance Sensor Reading(mm) : " + str(my_distance_sensor.read_mm()))

This is basically the code from /home/pi/Dexter/GoPiGo3/Software/Python/Examples/easy_Distance_Sensor.py with the comments stripped out.

-Kevin

2 Likes