BootySnorkeler
Member since Jan 2017 • Last active Oct 2020Most recent activity
-
Hello y'all,
I recently made a project, it's a watch powered by the MDBT42Q and a CR2032 coin cell, whch is 220 mah.
full details here: https://iamericmin.github.io/tm5.html
It's an updated version of a previous watch that also used an MDBT42Q and a smaller CR1225 cell, which is only 50 mah. The old watch lasted about two weeks, but mine can't go more than two days!The only culprit I can think of is the external crystal. I added a 32khz crystal with 22pf caps to the new watch, maybe that's why? The previous watch just tracked time with its internal crystal.
Also, the Espruino website says that MDBT42Q modules go to deep sleep automatically when proper conditions are met. So I'm really baffled here :'(
Any help would be greatly appreciated. Thanks!
-
@Gordon Oh my goodness thank you so much! It works like a charm :)
One question tho, what does "+" do before and after a variable? Since you wrote '+i+' and '+x+' when referencing to elements in the array segs[]. I've never seen that before in any language. -
Hi,
I'm trying to write a simple LED animation for a 7-segment display. It will light up a segment, then another one, then another one, until all are lit up, then dim a segment, then dim another one, etc. The code is (supposed to be) very simple. For reference, I'm using an MDBT42Q module with a 32khz crystal added on P0 and P1 with 22pf caps. I don't think it should affect my code.
var segs = [A, B, C, D, E, F]; // array of LED segments, each a variable for a pin for (int i=0; i<6; i++) { digitalWrite(segs[i], 1); // light up the first segment in segs[] digitalPulse(D30, 0, 100); // pulse unused pin for 100ms, this is just a simple delay } for (int x=5; x>=0; x--) { digitalWrite(segs[i], 0); digitalPulse(D30, 0, 100); }
and well, the code works as if the digitalPulse()es aren't even there. Everything happens very quickly so the LEDs just light up and off in a fraction of a second. I honestly have no idea why this isn't working as the other digitalPulses in the rest my code work just fine. I have other LED animations that use digitalPulse() in my code and those animations have no problem.
So I tried using setTimeout(). I believe it's like so, but I might be wrong:
for (var i = 0; i<6; i++) { setTimeout('digitalWrite(segs[i], 0)', 100); } for (var x = 5; x>=0; x--) { setTimeout('digitalWrite(segs[x], 1)', 100); }
this one doesn't work either. So I tried another method:
digitalWrite(A, 1); digitalPulse(D3, 0, 100); digitalWrite(B, 1); digitalPlulse(D3, 0, 100); digitalWrite(C, 1); digitalPulse(D3, 0, 100); . . .
And same results.
This has been driving me absolutely bonkers for the past few hours so any help would be greatly appreciated! -
-
Hi there,
I want to make a small robot that moves with two vibration motors on each side. I will remove the motors' eccentric weights and replace them with small wheels, so the vibration motors will essentially act like really small DC motors. I'm thinking of using an MDBT42Q. How do I connect the motors to the microcontroller? Should I just connect one wire to a signal and another to ground? Or are there passive components needed?Also, how long would my robot last? It will have two mini vibration motors, two green LEDs(on for about 5 minutes I think) and will be recieving commands OTA via bluetooth. It's all powered by a CR2032 battery.
Thanks!
No, I used the regular MDBT42Q firmware from Gordon. I didn't build a custom one. Would enabling the crystal draw more power? Also I don't think I have my serial pins high but I'll check.