-
-
@allObjects you are a Godesend! I'm going to stop asking questions for a while and go try to build build build with all of this magnificent teaching. You (and others on this thread) are really very good educators and I respect the levels of complexity.
Would love to see some pictures (when the mood strikes you) of things you've made - not that I've ever ventured into ham, but it is intriguing. The closest I've come is an SDR dongle as a listener/explorer of frequencies...
-
Wow, thank you. So many things here for me to digest. As always, please forgive my lack of experience, but 1) these are functions within a function... each assigned to 1-bit changes? Is that right? and 2) Espruino (and JavaScript) interpret 'on the fly,' so to speak?
And 3) if I was using, say, a polling version for MPR121 key strokes successfully (e.g., I can play a C# for as long as I hold down the appropriate key), and I wanted to use an ADC (potentiometer) to alter PWM in realtime while the note is playing continuously, could I?
I'm not sure I fully understand the order in which the code gets interpreted by the Espruino, and therefore where to embed my "mod wheel" potentiometer loop. Or maybe I just get confused by loops within loops...
In any case, I sure do appreciate all of this, @allObjects!
-
-
@SimonGAndrews @allObjects thank you so much. This looks fun, and I feel a wave of new questions percolating. But to be sure, I first have some testing and experimenting to do. I'm going to try the IRQ method.
@SimonGAndrews, with your 12-key project, do you happen to remember where you embedded your key-specific functionality? For example, did they live inside your touchedIRQ() function? And were they, like, "If keys == 3, do something?"
-
Oh wow - great! Thank you for this as well. I imagine it's hard to predict where people come in from when they're trying out a project, but I guess if you know where they end up, the "commonly referenced links" is pretty handy. I'll be checking that out soon for sure.
As a side note, my day job is writing instructor at a small college in Syracuse - and one of the things that interests me is hardware/software documentation online. A fascinatingly complex endeavor - and not sure if it could even exist outside of group efforts and the thoughtfulness of people like yourself who contribute to a community's efficiency.
-
-
No apologies required! :) This project has already brought me closer than ever to "bare metal" than I've really gone before (like, looking - even from the distance of a free library that I didn't have to write - at things like hardware addresses), so it is all new, all fun, all confusing, and all very much appreciated.
I also find myself into deeper functions - more complex thinking - than I'm used to, but I welcome the challenge fully. So, your suggestion helps me learn and do new things. How amazing. And you have drawn my attention to options I've certainly overlooked. I was accidentally pretending the IRQ pin wasn't even there. ;)
-
I really am amazed at how much time you just saved me. Thank you so much. Later tonight, I'll be able to hook up my device and send this to it.
As you may have guessed, I am at a very beginner level of understanding - yet I understand and appreciate your clear explanation. The fact that you handed it to me on a silver platter is just amazing. Thank you so much.
Once I have my beep-boop-beep DIY "synth" making sounds, I will show the results.
Lastly, I've never experienced a more positive helpful forum anywhere on the Internet. So, thank you @Gordon @allObjects @Robin
-
Again, thank you very much for taking the time. I imagine my console stuff is less interesting (for the version I was writing, which had malformed elements) given @allObjects solution below. I appreciate you!
-
-
It is starting to make sense. Thanks again!
Currently, the Espruino IDE is unhappy with the word, "function," as a 'reserved word,' and is giving red flags there and at the 100ms specification. I shall read up on setInterval and tinker more...
Here are some bold (untested) modifications for my project, in case anyone wishes to see:
I2C1.setup({scl:B8,sda:B9}); I2C2.setup({scl:B10,sda:B11}); var lastKeyPressed = 0; var lastBankSelected = 0; var mpr1 = require("MPR121").connect(I2C1, { //device 1 (12-key musical keyboard) is ready setInterval(function() { var keys = mpr1.touched(); if (keys!=lastKeyPressed){ for (var i=0;i<12;i++){ var kbit = 1<<i; if ((keys&kbit) && !(lastKeyPressed&kbit)) //do something, for example: console.log("Key: " + i); } } lastKeyPressed = keys; }, 100); }); var mpr2 = require("MPR121").connect(I2C2, { //device 2 (12-position rotary switch) is ready setInterval(function() { var banks = mpr2.touched(); if (banks!=lastBankSelected){ for (var j=0;j<12;j++){ var bbit = 1<<j; if ((banks&bbit) && !(lastBankSelected&bbit)) //do something, for example: console.log("Bank: " + j); } } lastBankSelected = banks; }, 100); });
-
-
Hi - just getting started with an original Espruino board. I'm trying to test my MPR121 capacitive sensor breakout board, which I've connected via I2C.
I am aware of this: https://www.espruino.com/MPR121 but I just don't know where to start understanding how to talk to the 12 electrodes.
Anyone have a beginner-friendly explanation of how to set up some basic code or blocks - something that would display something like, "Key 1 of 12 has been pressed!" "Key 2 of 12 has been released!"
Truly, any nudges in a learning direction would be much appreciated.
-
Hi everyone! I fired up an older project today that had been working perfectly, and then (maybe after a firmware update?) I received a similar error. Can anyone please help me understand what I am looking at here?
Here's the first part of my .BOOTCDE:
Modules.addCached("MPR121",function(){exports.connect=function(a,g,d){d=d||{};let b=d.address||90,f={read:c=>a.readFrom(b,c),write:c=>a.writeTo(b,c),touched:function(){a.writeTo(b,0);var c=a.readFrom(b,2);return c[1]<<8||c[0]},setThresholds:function(c,h){for(var e=0;24>e;e+=2)a.writeTo(b,65+e,c),a.writeTo(b,66+e,h)}};a.writeTo(b,[94,0]);a.writeTo(b,[43,1]);a.writeTo(b,[44,1]);a.writeTo(b,[45,0]);a.writeTo(b,[46,0]);a.writeTo(b,[47,1]);a.writeTo(b,[48,1]);a.writeTo(b,[49,255]);a.writeTo(b,[50,2]);f.setThresholds(15,
8);a.writeTo(b,[92,d.config1||32]);a.writeTo(b,[93,d.config2||32]);a.writeTo(b,[94,143]);g&&g(f);return f}});
And here's my error message (screenshot):
Any help is greatly appreciated! :)