Skip to content

Instantly share code, notes, and snippets.

@46cv8
46cv8 / cigman_cm-701_laser_receiver_main.cpp
Last active May 16, 2025 23:35
Receiver firmware for cigman CM-701 10khz pwm laser level using atmega32u4 and opt101 photodiode
/*--------------------------------------------------------------------
For CIGMAN CM-701, but may work with other laser units if you change the frequency to match.
You should use a frequency for the ADC exactly 4x the frequency of the laser PWM of our leveling unit.
Laser-Level Receiver → ATmega32U4 ADC @40 kHz → 4-sample
min/max with accumulation → EMA(high,low) → Tone mapping → Serial @50 Hz
--------------------------------------------------------------------*/
#include <Arduino.h>
// ——— USER CONFIGURATION ———
import os
import asyncio
import uuid
import xml.dom.minidom
import aiohttp
import bleak
import pywifi
import logging
# pip install bleak