This youtube video https://www.youtube.com/watch?v=LjC57uH3AEE is just a lark.
Version 2 of the PCB (as in the video): The schematic is an embarrassment--I couldn't find an Eaglecad footprint for the ESP32 D1 Mini, and I've never successfully created a part in Eagle, so I just used 2 dual-row 20-pin footprints. The schematic is Version 3--I removed the possible DS18B20 pullup on pin 12 (which would prevent booting), and gathered input pins 34, 35, 36, & 39 in one place for easier connection of an ebay 4-pushbutton module.
PCB v3 sch and pcb.jpg: Tested: SD card, ILI9341 tft, touch, serial, serial 2 @ 9600, I2C with an MCP23017, various led outputs, 7 DS18B20s, 4 inputs with 100K pullups, and mono audio output using pin 25.
I was unable to get the PCM5102A I2S DAC to work, either from the PCB or with flying wires directly from the D1 Mini, with 2 different DAC modules. Checked and rechecked the wiring. I had gotten this to work in the past, so I don't know what the problem is.
This is my funky code for the youtube video:
Code: [Local Link Removed for Guests]
I2C.SETUP 21, 22 ' set I2C port on pins 21-sda and 22-scl--esp32
TFT.INIT 1
TFT.FILL 0
PIN.MODE 12, OUTPUT
PIN.MODE 17, OUTPUT
PIN.MODE 33, OUTPUT
PIN.MODE 2, OUTPUT
PIN.MODE 16, OUTPUT
PIN.MODE 5, OUTPUT
pin(12)=0: pin(17)=0: pin(33)=0
pin(2)=0: pin(16)=0: pin(5)=0
MCP23017 = &h20 ' assumes A2, A1, A0 to GND
'MCP23017 internal registers
IODIRA = 0: IODIRB = 1: IOCONA = 10: OLATA = 20: OLATB = 21
i2c.WriteRegByte MCP23017,IODIRA,0 ' set direction to output
i2c.WriteRegByte MCP23017,IODIRB,0 ' set direction to output
I2C.WriteRegByte MCP23017,OLATA,0 ' turn all off
I2C.WriteRegByte MCP23017,OLATB,0 ' turn all off
play.setup 0 ' speaker, pin25, mono
pause 3000
a$="/cherokeeshuffle.mp3"
'a$="/FireballMail.mp3"
play.volume 80
PLAY.MP3 a$
pause 500
pin(12)=1
pause 500
pin(17)=1
pause 500
pin(33)=1
pause 500
' do
ntimes=6
gosub mcp17
pause 1000
ntimes=1
' loop
tft.text.pos 2,5
TFT.FILL TFT.RGB(255,0,0) ' red
tft.text.col TFT.RGB(255,255,255),TFT.RGB(255,0,0)
tft.print " Hello, Annex World"
pause 2000
tft.text.col TFT.RGB(255,255,255),TFT.RGB(0,255,0)
TFT.FILL TFT.RGB(0,255,0) ' green
tft.print " Hello, Annex World"
pause 2000
tft.text.col TFT.RGB(255,255,255),TFT.RGB(0,0,255)
TFT.FILL TFT.RGB(0,0,255) ' blue
tft.print " Hello, Annex World"
pause 2000
TFT.FILL 0
do
x=rnd(319)
y=rnd(239)
c=rnd(65535)
r=rnd(50)+10
tft.circle x,y,r,c,c
' pause 100
gosub mcp17
pin(2)=1-pin(2): pin(16)=1-pin(16): pin(5)=1-pin(5)
if PLAY.ISPLAYING = 0 then
if a$="/cherokeeshuffle.mp3" then
a$="/Fire on the Mountain.mp3"
else
a$="/cherokeeshuffle.mp3"
endif
PLAY.MP3 a$
endif
loop
mcp17:
for i = 1 to ntimes
i2c.WriteRegByte MCP23017,OLATA,&HAA ' &b10101010
i2c.WriteRegByte MCP23017,OLATB,&HAA ' &b10101010
PAUSE 250
I2C.WriteRegByte MCP23017,OLATA,&H55 '&b01010101 '
I2C.WriteRegByte MCP23017,OLATB,&H55 '&b10101010 '
PAUSE 250
Next i
' I2C.WriteRegByte MCP23017,OLATA,0 ' turn all off
' I2C.WriteRegByte MCP23017,OLATB,0 ' turn all off
return
The Version 3 Eaglecad sch and pcb files are also attached, and can be modified freely (remove the .txt file type).
Thanks so much to cicciocb for creating such a powerful BASIC for the ESP32 (and ESP8266).