<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[mycobot] I want to on&#x2F;off an electromaget with python code]]></title><description><![CDATA[<p dir="auto">Anyone know how to plug in the electro magnet to a mycobot? Its a small magnet like 5v or less with 2 wires coming out of it. I then want to be able to turn it on/off using python code</p>
<p dir="auto">I have some code like this but not sure how it work or if it works (i dont know how to plug in the magnet either)</p>
<p dir="auto">&lt;code&gt;</p>
<p dir="auto">from pymycobot.mycobot import MyCobot<br />
import time<br />
import pdb<br />
#pdb.set_trace()</p>
<p dir="auto">mc = MyCobot('COM5', 115200)</p>
<p dir="auto">i = 1<br />
while i &lt; 60:<br />
mc.set_basic_output(i, 1)<br />
mc.set_digital_output(i, 0)<br />
time.sleep(.1)<br />
mc.set_digital_output(i, 1)<br />
time.sleep(.1)<br />
mc.set_digital_output(i, 0)<br />
time.sleep(.1)<br />
print(i)<br />
i += 1</p>
<p dir="auto">&lt;/code&gt;</p>
]]></description><link>https://community.m5stack.com/topic/5020/mycobot-i-want-to-on-off-an-electromaget-with-python-code</link><generator>RSS for Node</generator><lastBuildDate>Sat, 16 May 2026 04:11:57 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/5020.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 02 Feb 2023 07:14:15 GMT</pubDate><ttl>60</ttl></channel></rss>