-
Thanks @Gordon .
i bought at lextronic french reseller (with more stock) sorry for that, i prefer buying on your shop)
i bought an MDBT42Q breakout to try and some pico cause i love form factor.
next week it's holliday and have some time to play withbest regards
é. -
ok nobody want helps?
is the Module MDBT42Q Breakout is enough to start?
convert it as a bluetooth HID like a keyboard?
i read some post about that.
if the device (the breakout) is detected as an hid bluetooth by the os, the html page doesn't have to detect an hid!? it's a keypress detected, no more.é.
-
Hello,
i'm new with bluetooth.
i would like to connect a rotary encoder to an ipad or an android phone and use the rotation in a web app.i'm able to connect the rotary and a pico board to an html page trough the HID feature on my computer.
but now i would like to communicate to a smart thing (small screen,,,) device via BT.Which board do i need to do that, is BT, the good solution ?
Please advice me.regards
éric
ps: @Gordon there is only one unpinned pico board in stock in the shop! really?
-
OK thank you @Gordon
the final solution was the pull_up
function onInit() { var value = 0; pinMode(A8, 'input_pullup'); pinMode(A5, 'input_pullup'); setWatch(function(e) { if (e.data) value++ else value--; print(value); }, A5, {data:A8, repeat:true, edge:'falling'}); }
the value increases and decreases according to the rotation.
é.
-
Hello @gordon
what is suppose to do?
e.data
is alwaysfalse
when it fire. So,value
stepdown what ever i turn clockwise or counterclockwise...regards
é.
-
-
no more answer than mine... okay it's not really interesting, nevermind... there is a glitch in the lib...
and my attempt is not 100% efficient.
if I turn the encoder quickly, the algorithm slips, and the number advances slowly with a step backwards from time to time...a better idea than mine?
regards
éric
-
i've corrected my pb with an ugly trick but it works as i need.
it sends through the serial :
1
for clockwise and pulse Green led
-1
for conterclockwise and pulse Red ledfunction onInit() { var step = 0; var final = 0; require("Encoder").connect(A5, A8, (temp) => { step += temp; if (Math.floor(step / 4) == step / 4) { (step > 0) ? dir = 1: dir = -1; step = 0; (dir > 0) ?digitalPulse(LED1, 1, 20):digitalPulse(LED2, 1, 20); print(dir); } }); }
-
-
Hello,
i'm playing with a rotary encoder a big MYSM60-100PPRR-5L with the example given
but the console is populated with too many answer for 1 step.function onInit() { var step = 0; require("Encoder").connect(A5,A8, (dir) => { print(dir); if (dir > 0) { //allume la led 20ms digitalPulse(LED1, 1, 20); } else { digitalPulse(LED2, 1, 20); } }); }
console return for 1step backward
-1 -1 -1 -1 -1 1 >
and
1 1 1 1 >
for 1 step forward...
what i'm doing badly?
-
@Gordon Thanks
i'll try tomorrow
I'm able to clean the output, but i was looking for a way to have a clean output (easer to explain the code to beginners)regards
-
I had a switchto switch on/off setConsole on USB or on an other Serial
I useprint
nonconsole.log
i've tried this
let laser; function lis(){ let somme=0; var dist = laser.performSingleMeasurement().distance; print(dist); //console.log(dist); //console.log("distance: ",dist," lissée:",somme/table.length); analogWrite(LED1, (1000-dist)/1000, { soft:true, freq:200 }); } function onInit() { //Serial1.setup(115200); I2C2.setup({sda:B3,scl:B10}); laser = require("VL53L1X").connect(I2C2); print("init"); digitalWrite(B4,1); // set XSDN -> turn the sensor on setInterval(lis, 150); pinMode(A6, 'input_pulldown'); setWatch( function (e) { console.log(e.state); if (e.state) { Serial1.setConsole(); } else { USB.setConsole(true); } }, A6, { repeat:true, edge:"both", debounce: 100 }); }
if i move the console to another Serial...
nothing come in Processing
otherwise my output is always crippy> [J1587
1587
is my number:v
Any idea
-
USB object is an instance of Serial
https://www.espruino.com/Reference#l__global_USBThere is no exemple! to initiate the USB
have you one?
should i use this?
E.on('init', function() { USB.setConsole(); });
Or
USB.setConsole(true);
?regards
é.
-
I know this certainly a stupid question.
i'm prototyping something for my students
i use a V53L1X connected to my pico.
i would like to transfer the datas to Processing.
i connect the Pico on the usb plug.should i use
console.log
orprint
to transmit my data?should i initialize a serial port?
Serial1.setup(115200);
some time the console send error from the program (i2c init);
i'm really confuse, it should be simple, but it's not.
sometime nothing arrive to Processing.i've got an other problem, the string received start with an invisible char and
[J
How should i do to have a clean string with distance value?
Could i use midi thru usb to send datas?
i should split my value [0-4000] in 2 set of 7bits (midi value)thanks for your help
éric
let laser; function lis(){ let somme=0; var dist = laser.performSingleMeasurement().distance; //print(dist); console.log(dist); //console.log("distance: ",dist," lissée:",somme/table.length); analogWrite(LED1, (300-dist)/300, { soft:true, freq:200 }); } function onInit() { Serial1.setup(115200); I2C2.setup({sda:B3,scl:B10}); laser = require("VL53L1X").connect(I2C2); console.log("init"); digitalWrite(B4,1); // set XSDN -> turn the sensor on setInterval(lis, 80); }
and the processing sketch
import processing.serial.*; Serial myPort; // Create object from Serial class int val; // Data received from the serial port void setup() { size(200, 200); // le port de l'espruino sur mon mac est en 3 String portName = Serial.list()[3]; myPort = new Serial(this, portName, 115200); } void draw(){ while (myPort.available() > 0) { String inBuffer = myPort.readStringUntil('\r'); if (inBuffer != null) { String[] q = splitTokens(inBuffer, "[J"); if (q.length > 1) { val = int(float(q[1])); println(val); } } } }
-
Thanks @Robin,
I started with the same example, but i missed the ‘toString()’ to convert my counter in String in my attempt.It works now...
thanks again.
Regards
-
Hello,
I'm looking for to store a var in a permanent way (power off) and load at start (power on)
i saw that @Gordon implement a way to store data since 2v05, but the example code is for log datas (implementative way) and it seems a beat complex just for store a counter var.have you a simple example to implement a counter (with a long type) storage over power-down?
I've tried
var memoire = require("Storage"); [...] let NumPoemeEncours = memoire.read("num"); // numero encours if (NumPoemeEncours == null || NumPoemeEncours == undefined || NumPoemeEncours == "") { NumPoemeEncours = 1; console.log("numero du poeme inconnu", memoire.read("num")); memoire.write("num",NumPoemeEncours); console.log("numero du poeme connu", memoire.read("num")); } console.log("NumPoemeEncours:",NumPoemeEncours);
but it does not works!
what i'm doing wrong?
thanks for your time.
-
Do you need this at the same time? Because it would potentially be really bad news to attach power to the USB power input and then plug it into your PC as well.
Not at the same time of course, but the possibility to scratch the paint and uncover the mini usb pads and sold 2 wires seem to be a bit dangerous if i need to plug the usb in my computer to update code.
there is a samsung travel charger with slim wire in black or white, and is cute and strong enough to power a simple led matrix.
sorry instagram link to see picture
https://www.instagram.com/p/COrzei-h9uH/ -
Hello,
i've got a simple question, but sorry for that i found the power section of the pico board a bit confused.
I would like to power the board with a phone charger, not with a battery.
On wich pin do you recommand to power the pico (i need to access to usb pad for code update purpose)
i connect a led matrix (only one 8x8) and need the 5v for the max7219 driver...actually, i 've sold a micro usb female deported plug on pin Vout and GND (silkscreened on the back board)
am i doing it wrong? (sorry for grammar, not sure about that)i've tried on the + - battery pad, but curent is not enough on the output a read only 2.7V on the Vout pin...
regards
é.
-
Hello @Gordon, sorry for late answer, have to test more to give feedback.
The optimal 4bits palette does not works.... the display seems to use only the 16MAC Palette even if i iniate with the palette generated by online converter tools.
I've tried with 2 differents (cheap) displays a 128x128 1.44", and a 1.8" 128x160 from ebay.
the palette does not works in 4 bits mode.
and as the screen is initialize with 4 bit palette, the 16bits pictures are wrong color... (even if i modify thecmd(0x36,0xC8)
, tocmd(0x36,0xC0);
(the RGB to BGR bit in the datasheet)
i don't find a way to initialize the display in 16bits.
if we remove the palette option, it produces an error.regards.
any help would help.
é.
-
-
-
well i do not understand wich format can be used to directly loadImage from storage as in exemple!
is it a bmp file in 1bit? or a what?
how to put img file in the storage area of the espruino?
am i wrong, it only works with a sd card module?i have to admit, i'm a beat confuse. sorry
g.drawImage(require("Storage").read("myimage.img"), 10, 10);
-
-
well i build a MAC16 palette in photoshop as your script does (the online tool)
now i can export the image "as is".Now on my screen, the color does not match.
what is suppose to be a gray #bbb is purple and the gray #444 is green...
no matter i change the palette reference by reorganize (in photoshop) the place of each color as in your coded palette...oh and i use your palette as the ref palette.
what's wrong?var img = { width : 128, height : 128, bpp : 4, buffer : require("heatshrink").decompress(atob("mUzAJIAJmUykMRiAAEiIHDiMiDZQjIGZwAMkURgI5BABEBgMTFC4AVmJ3EHYgJEU4MSFCqAUn8yOgiAKQIc/DIbFWIxp9BOgL1DAYUARAoJDkY7UPiICBPRQJEAgQCBgMCfUpSBkEAHYr/FAAMhQA0Tf8J8BAIMyfBsRiUSfoQJDgLBBf65+MO4hyCOgYACP4aAFiT/jPxZyBBgR/CBIgACl7/ikD5HPop/DQAYAEQB4ASfpyACP4MiA4KCGf4IBBAAIDDYZJ+Pdoj/LQAILFgCARf6JpCQJgNCP4QHEQI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SACkMiP4oiFEIL/WPwcyiUhfoz/HOARxBQAgBEPwcSPwb/FP5psBkEikB4CfwgCCiJ/DQAaBBLwj8EBoT+Ff5D9FEIRmBGIJTBPwSAEPwT/CCgRFBQISICAAQeBCYMSiL+HE4MCP5w/BfpACBDwJ+DAAR+BAIKKGPwacFf5iAGfwMjPQaDCAAbcBOo4AHfYQFCP5AnBiMTfxsSQIL/ELob+BP4YWDGYR2CAAoJCEIR+Df5oACfwcyLAp/NQBQDDPwYDDEoIBBP5ZEBH4MxKwj/DPwL0CPwRaEQQiEDA4Z8CAAb/OVQUyiYcBPw8RgRrCPw0zQ4MjQRD+Mf5sxDgMgPoh+FNgLZDQBKCDAYT8CD4b/GEAT9FP4TbCP4j8EFQT+HQASCDQgYCCToSBFPoICBP5hcDLAwZBN4Z9DQA6DIP4SBDf4kQf5h+BfIZ+GOAgaCn5fIPwYDCLYJ/WmJ8CLYoBBdIZSDQBh/UEYZ+EmS0CLIIABLQcCPwb1CABILDPgJ/CkIeCEYIlDPwSnBERRUEK4kAfoRRDDRALDQAYBBkJ/CQIr/OAILUELATXCiT6EAAj/BAIKCGAAciDoQAFBAcRgR/KA==")) }; function draw() { digitalPulse(LED2, true, 20); g.clear(); g.drawImage(img,0,0); g.flip(); } var g; function onInit() { A5.set(); // Backlight On var colorPalette = new Uint16Array([ 0x000000, 0x444444, 0x888888, 0xBBBBBB, 0x996633, 0x663300, 0x006600, 0x00aa00, 0x0099ff, 0x0000cc, 0x330099, 0xff0099, 0xdd0000, 0xff6600, 0xffff00, 0xffffff]); // 2 couleurs pour la palette // init spa var spi = new SPI(); spi.setup({mosi:B15 /* sda */, sck:B13 /* scl */}); g =require("ST7735").connect({ palette:colorPalette, spi:spi, dc:A7, cs:B10, rst:B1, // height : 160 // optional, default=128 }, draw ); }
hello @AdaMan82
sometime pico have strange behavior too and crash with clean code.
reflashing take few seconds than trying to identify uncommon behavior in code is timeconsuming.
i downloaded last firmware to avoid low connexion :)
regards