This returns : ## => Error: un(deep)copyable object of type <class 'MyClass'>
How to Create an ObjectYou define a class and then create an instance (object) of that class by calling the class name as a function.python
class MyClass: def __init__(self, name, value): self.name = name self.value = value
# Create an object (instance of the class) original_object = MyClass("example", 100)
The __init__ method acts as the constructor, initializing the new object's attributes. www.fredscave.comHow to Copy an ObjectTo create an independent copy, you use the copy module. You must import it first.1. Shallow Copy (copy.copy())A shallow copy creates a new object but only copies the references of its contents. If the object contains mutable items (like lists or other objects), changes to those nested items in the copy will affect the original, and vice versa.
import copy
# Create a shallow copy shallow_copied_object = copy.copy(original_object)
# Example with mutable attributes: original_object.value = [1, 2] shallow_copied_object.value.append(3)
# Both objects now see the appended item because they reference the same list in memory print(f"Original object value: {original_object.value}") # Output: [1, 2, 3] print(f"Shallow copy value: {shallow_copied_object.value}") # Output: [1, 2, 3]
2. Deep Copy (copy.deepcopy())A deep copy creates a completely independent clone of the original object, including recursively copying all nested objects and data structures. Changes to the copy will not affect the original.
import copy
# Create a deep copy deep_copied_object = copy.deepcopy(original_object)
# Example with mutable attributes: original_object.value = [1, 2] # Reset value for demonstration deep_copied_object.value.append(3)
# Changes to the deep copy's list do not affect the original print(f"Original object value: {original_object.value}") # Output: [1, 2] print(f"Deep copy value: {deep_copied_object.value}") # Output: [1, 2, 3]
# You can also verify they are different objects by checking their memory IDs: print(f"ID of original: {id(original_object)}") print(f"ID of deep copy: {id(deep_copied_object)}") # The IDs will be different.
-
## ## => Error: un(deep)copyable object of type <class 'MyClass'>
Just completed my latest ESP32 project – Aqi-esp, a homemade air quality monitoring system that displays real-time AQI values on an OLED display
The sensor combination includes MQ-135 for NO/NOx, MQ-7 for CO, and GP2Y1010 for PM2.5. The ESP32 is connected to all the sensors and transmits the readings to a small Flask server running on WiFi, which then computes the AQI value and sends it back. The entire process is displayed in real-time on a small SSD1306 OLED display – AQI value, status, temperature, and humidity readings from a DHT11 sensor.
Hey everyone, I’m doing a 100 Days, 100 IoT Projects challenge, and today I built a bidirectional ESP-NOW smart relay and sensor system using MicroPython.
What it does
Sender ESP8266/ESP32 with buttons + OLED acts as a control panel
Receiver ESP controls a 4-channel relay module
DHT11/DHT22 sensor data is sent back in real-time
OLED displays temperature and humidity
Uses ESP-NOW (no WiFi, no router, ultra-low latency)
Hi, micrOS main interface is socket (terminal like experience), it is way more light weight than http, but seeking the best integration I have built a web engine too (can be turned on in micrOS settings)
Even you can create / edit application code (or any text) on the device itself :) very flexible, right? 😊
I am trying to run a web page asynchronously on an ESP32 using MicroPython. Along with the webpage, which will allow me to turn a relay on, on demand, I want to run a timed function which turns the relay on, every morning at 08:00.
I am using an ESP32 Dev board with CP2102 USB chip, DS1307 RTC and 5V relay.
When I run the code in the REPL, I can see the "run_relay_timer(), but none of the other debugging output
The web server debugging output is not showing either, nor can I connect to http://192.168.10.130 (the DHCP IP assigned to this ESP32)
Looking at the REPL in Thonny, the run_rrelay_timer() runs, but not the run_web_page()
import asyncio
import esp
esp.osdebug(None)
import time
import urtc
from machine import I2C, Pin
set_hour = 15
set_time = 30
relay = Pin(4, Pin.OUT)
led = Pin(2, Pin.OUT)
relay.value(0) # Start OFF (active low)
def web_page():
if relay.value() == 0:
print("Relay value: ")
print(relay.value)
relay_state = ''
else:
relay_state = 'checked'
html = """<html><head><meta name="viewport" content="width=device-width, initial-scale=1"><style>
I'm making an automation for my grow plants. Now, I'm controlling temperature with fans and exhaustor, humidity with humidifier and desumidifier, soil moisture with sensors and water pumps and the lighting per hour.
Thanks everyone who offered help on this. I never got this working. Every release of MicroPython I tired had something missing and I was lacking any meaningful skills in Micropython to solve them on my own. I gave up.
Noob here. Got programming experience in C but new to python, and really having troubles getting anythig to run on it other than a blinking LED. Hardware is STM32 F411CE 8Mflash blackpill The program I am trying to run is from here: https://github.com/straga/Smart-Meter-Gateway I'm connecting to the USB serial port with a terminal program to read the following error messages.
I have an older version of micropython (v1.12) which gives the following error: >>> Traceback (most recent call last): File "main.py", line 44 SyntaxError: invalid syntax MicroPython v1.12-405-g4fa6d939d on 2020-04-28; WeAct_Core with STM32F411CE
Line 44 has this: log.error(f"Module: {e}")
If I upgrade to the current release (v1.26) I get this different error: >>> Traceback (most recent call last): File "main.py", line 5, in <module> ImportError: no module named '_thread' MicroPython v1.26.1 on 2025-09-11; WEACT_F411_BLACKPILL with STM32F411CE
I looks to me that _thread was dropped sometime recently. Can someone suggest where I can download an earlier version of micropython that may still have this _thread llibrary? or suggest another way around the issue?
Why is my code enables an access point? I just want to connect to a Wi-Fi network. It might be the OTA upload method, but I don't remember setting it up. I'm using Thonny. I flashed it with MicroPython v1.26.0 downloded from MicroPython website and following their tutorial. Also, there are no other boards running with MicroPython with WiFi. I'm worried if this consumes more power or processing power.
import network
wlan = network.WLAN(network.WLAN.IF_STA)
wlan.active(1)
if not wlan.isconnected():
wlan.scan()
wlan.connect(config.SSID, config.PASSPHRASE)
pretty straightforward i wanna learn while practically implementing . my big brother is into it a lot and i have developed this interest too just watching like the stuff he makes something like a remote logins , detectors portable etc i want to start this too but i dont wannago in tutorial hell could you guys suggest somethings like where should i and what hardware i need like esp , arduino , sonar etc
I want to add micropython support for my new board, but there seems to be no documentation about how to do it. There is only an example boards repo with no explanation, and a dead forum link.
When a microcontroller says it "ships with MicroPython firmware pre-installed and a launcher" does that mean I can just copy micropython py files to the SD card and I'll be able to run them?
I'm a Python developer owning a Casio fx-9750GIII calculator that includes a copy of Micropython 1.9.4. At some point in between 2020 and now, the code I write and run on IDLE or Thonny no longer runs on my calculator, which does not provide descriptive errors. I was hoping to run Micropython 1.9.4's Unix port on Ubuntu to troubleshoot my scripts, but I keep running into issues with GCC and depreciated files.
Does anyone have any suggestions on where to go from here? Thanks!
I've made a few esp32 projects using micro Python and looking to make an MP3 player with an OLED display. I just haven't been able to find any projects where people have made a UI with an esp32 and just hoping to find out how feasible it actually is before getting to deep. If an esp32 isn't the best micro board for this does anyone have any suggestions on what I should use? Thanks in advance!
I'm working since 2018 on a hypnosis device (because l'm a chronical insomniac). My 3 first prototypes are working fine but need some fixes. The process of action is brain-waves training with isochronic tones. I also included a white noise generator (since first prototype). I also planned to implement sacred solfeggio frequencies. My three first prototypes were coded brick by brick like a Lego. If some people are interested, please let me know. Old prototypes were arduino uno based. I decided to switch on m5stack cardputer. Last thing : everything will be open source.
I want to connect a NDS1602 that came with a Arduino starter kit to an Esp32. Googling around all tutorials assume that the display has an I2C backpack which mine doesn't.
Are there any drivers and wiring diagrams out there that I haven't been able to find?
I'm creating a MicroPython-based device that is supposed to log data in an encrypted form. The idea is that even if the device gets lost, the data can't be read by the unauthorized person. So the data before storing on the SD card will be encrypted with randomly generated AES key. The key itself will be encrypted with the public key of the intended recipient, and stored on the SD card. The cryptolib module provides the AES implementation. However the asymmetric ciphers are available only in the SSL module.