Raspberry BASIC > General Discussion
ESP32 MicroPython
John Spikowski:
I have spent hours trying to get my DHT11 and DHT22 working on Micropython using the DHT library. The measure() call returns a ETIMEOUT with every attempt.
Has anyone gotten this to work?
You don't need to join the forum to respond. Send an e-mail to support@raspberrybasic.org with suggestions would be appreciated.
John Spikowski:
I tried to install the ESP-IDF tools on my RPi 4B running Ubuntu 64 bit.
This sucks!
jrs@RPi-Dev:~/esp/esp-idf$ ./install.sh
Detecting the Python interpreter
Checking "python" ...
/home/jrs/esp/esp-idf/tools/detect_python.sh: line 16: python: command not found
Checking "python3" ...
Python 3.8.6
"python3" has been detected
Installing ESP-IDF tools
Installing tools: xtensa-esp32-elf, xtensa-esp32s2-elf, xtensa-esp32s3-elf, riscv32-esp-elf, esp32ulp-elf, esp32s2ulp-elf, openocd-esp32
ERROR: tool xtensa-esp32-elf does not have versions compatible with platform linux-arm64
jrs@RPi-Dev:~/esp/esp-idf$
On a positive note I was able to install the ESP32 development tools on my 4 GB / 2 core @ 2.13 ghz AMD old laptop. It's running Ubuntu 20.04 64 bit OS. Runs a lot faster than my RPi 3B.
John Spikowski:
I was able to get my NeoPixel stick working under MicroPython on my ESP32-PICO-D4 controller.
The picture doesn't do the color presentation any justice. Looks great live.
I can see this being used to create outdoor billboards. A string of NeoPixels to decorate a Christmas tree is another idea.
--- Code: Python ---import machine, neopixeln = 8p = 5np = neopixel.NeoPixel(machine.Pin(p), n)np[0] = (255, 0, 0)np[1] = (0, 255, 0)np[2] = (0, 0, 255)np[3] = (128, 0, 0)np[4] = (0, 128, 0)np[5] = (0, 0, 128)np[6] = (125, 204, 223)np[7] = (255, 0, 153)np.write()
This example I converted from CircuitPython displays a rainbow effect.
NeoPixel Rainbow video clip. I hide the stick to cut down on the glare. 8)
--- Code: Python ---# MicroPython demo - NeoPixelimport time import machineimport neopixel pixel_pin = machine.Pin(5)num_pixels = 8 pixels = neopixel.NeoPixel(pixel_pin, num_pixels) def wheel(pos): # Input a value 0 to 255 to get a color value. # The colours are a transition r - g - b - back to r. if pos < 0 or pos > 255: return (0, 0, 0) if pos < 85: return (255 - pos * 3, pos * 3, 0) if pos < 170: pos -= 85 return (0, 255 - pos * 3, pos * 3) pos -= 170 return (pos * 3, 0, 255 - pos * 3) def rainbow_cycle(wait): for j in range(255): for i in range(num_pixels): rc_index = (i * 256 // num_pixels) + j pixels[i] = wheel(rc_index & 255) pixels.write() time.sleep(wait) while True: rainbow_cycle(0) # Increase the number to slow down the rainbow
Navigation
[0] Message Index
[*] Previous page
Go to full version