Page 1 of 1

MX1508 motor driver and CD reader defective.

Posted: Sun May 09, 2021 5:40 pm
by Fernando Perez

Code: [Local Link Removed for Guests]

' Wemos D1 mini
' Motor control module MX1508
' Mechanism of old damaged CD player
'
' GPIO12 (D6) = switch open
' GPIO13 (D7) = switch close
' GPIO4 (D2) = A2 of MX1508 = - Motor
' GPIO5 (D1) = A1 of MX1508 = + Motor

pin.mode 12,INPUT 
pin.mode 13,INPUT 

pin.mode 4,OUTPUT 
pin.mode 5,OUTPUT 

pin(4) = 0
pin(5) = 0

' if the door is not fully open or fully closed
if pin(12) = 1 AND pin(13) = 1 then close

onHtmlReload loadHTML
gosub loadHTML
wait

loadHTML:
cls
cssExternal "style.css"

a$ = "<center>"
a$ = a$ + |<div id="T1"><p>Restricted access area</p></div>|
a$ = a$ + |<div id="T2"><p>Authorized personal only</p></div>|

if pin(12) = 1 then a$ = a$ + button$("OPEN", open, "btn")
if pin(13) = 1 then a$ = a$ + button$("CLOSE", close, "btn")
    
a$ = a$ + "</center>"
html a$
return

open:
  pin(5) = 1
  do
  loop until pin(12) = 0
  pin(5) = 0
  gosub loadHTML
return

close:
  pin(4) = 1
  do
  loop until pin(13) = 0
  pin(4) = 0
  gosub loadHTML
return

https://www.myrapidq.it/public/style.css

I did this little project to learn about motor control with limit switches and take advantage of the mechanism of a broken CD player.
He also managed to entertain my grandson by using it as a liftgate for his construction toy. Only 15 minutes, but you know ... this generation!
image.png
https://www.myrapidq.it/public/puertaCD.mp4
Image