elephantrobotics / pymycobot

This is a python API for ElephantRobotics product.
MIT License
114 stars 55 forks source link

Setting Up WiFi using myCobot 280 M5 #38

Closed HCurrence closed 1 year ago

HCurrence commented 2 years ago

Hello,

I am trying to set up my 280 M5 to connect to WiFi using the set_ssid_pwd() function on my Windows computer. I am afraid I cannot find any instructions on how to do this on your GitBook or any documentation. I derived the usage below based on your coding comments.

from pymycobot.mycobot import MyCobot
import time

print("   Activating Cobot...")
mc = MyCobot('COM3', 115200)
mc.power_on()
time.sleep(5)
print("   Cobot is now active.")

mc.set_ssid_pwd("wifi_ssid", "wifi_password")

print(mc.get_ssid_pwd()) 

This is using pymycobot version 2.8.1 and miniRobot version 2.0. Is this correct? If so, the get_ssid_pwd() function is printing an empty list, and the WiFi credentials are not being sent to the cobot.

Output:

   Activating Cobot...
   Cobot is now active.
[]

Update 7/28/2022: I have only gotten this to work once, but the cobot was still unable to connect to WiFi. All other attempts to set up a WiFi connect have still failed. See the debug output below.

   Activating Cobot...
11:23:13.740 DEBU [pymycobot.generate] _write: [254, 254, 2, 18, 250]
11:23:13.750 DEBU [pymycobot.generate] _write: [254, 254, 2, 16, 250]
11:23:18.759 DEBU [pymycobot.generate] _write: [254, 254, 2, 32, 250]
11:23:18.780 DEBU [pymycobot.generate] _write: [254, 254, 2, 176, 250]
11:23:18.781 DEBU [pymycobot.generate] _write: b"'wifi_ssid'(wifi_password)"
11:23:18.782 DEBU [pymycobot.generate] _write: [254, 254, 2, 177, 250]
   Cobot is now active.
11:23:18.883 DEBU [pymycobot.generate] _write: [254, 254, 2, 17, 250]
[]
anla-xu commented 1 year ago

@HCurrence Please update pymycobot to the latest version and try again