# ESP32-ADXL345-rohdaten-sender.py from machine import Pin,I2C import ADXL345, network, espnow, time import time # ESP32 ADXL345 # SDA 21 gelb SDA # SDL 22 orange SDL # 3.3V rot VCC # Gnd blau GND i2c = I2C(scl=Pin(21),sda=Pin(22), freq=10000) adx = ADXL345.ADXL345(i2c) wlan_sta = network.WLAN(network.STA_IF) wlan_sta.active(True) e = espnow.ESPNow() e.active(True) peer = b'\xff\xff\xff\xff\xff\xff' e.add_peer(peer) led = Pin(2, Pin.OUT) kennung = "ADXL345-x" cnt = 0 while True: cnt += 1 x=adx.xValue y=adx.yValue z=adx.zValue msg = f'{kennung},{str(cnt)},{x},{y},{z}' e.send(peer, msg) print(msg) time.sleep_ms(500) led.value(not led.value())