-
I work with React at my job, and I really do love that stuff.
I don't know if it's relevant, but Preact is very similar to React, and is only like 3kb (with 0 dependencies).The way React actually works is by transpilation typescript/bable/webpack magic
This
function simplestReactComponent() { return <div>Hello world!</div>; }
Becomes this
function simplestReactComponent() { return React.createElement("div", null, "Hello world!"); }
It wouldn't under any circumstances be part of the interpreter, but I don't know if it's a good investment of time..
-
https://github.com/espruino/EspruinoDocs/pull/648
I think this is the first pull request I've ever done between forks and the first one on GitHub for that sake. I hope I did it correctly xD
-
-
-
Ah, yup in both Chrome, Edge and Firefox
(new Date()).getTimezoneOffset()/-60 = 2
That's not my timezone though, my timezone is GMT+1, which is also what I get if I print the same thing in the espruino terminal.
Interestingly I can see that my system (windows 10) timezone is set to +1, as it should be.
It's rather weird but certainly explains the issue, seems to be an issue with the computer rather than with bangle at least :) -
Ah, that was it, I just
- Flashed it
- checked the time, date timezone etc
- connected to the web IDE
- uploaded code
When I and went back to the main screen and the time was off by an hour.
I'm assuming the timezone is in GMT?The code I uploaded btw was just
setWatch(() => { Bangle.buzz(); E.showMessage("You\npressed\nthe button!"); setTimeout(()=>g.clear(), 1000); }, BTN1, {repeat:true});
I doubt the code itself matters though.
- Flashed it
-
Thank you for the prompt reply :)
I am on
Version 2v13
Commit e69c9990fI'm not on gadget bridge, I had however had it connected to the web IDE from time to time, though I didn't notice if that's when it changed, the clock locally on the PC is running correctly at least, so that's probably not the source of the error unless the web IDE is somehow setting the time based on some external source..?
-
So this is the actual servo script?
https://github.com/espruino/EspruinoDocs/blob/master/devices/servo.jsI thought it was just part of the documentation, I didn't think to look for the file in the EspruinoDocs repo xD
Anyway, I'll have a look at it this afternoon! :) -
The day I got my bangle I set it to a 24 hour clock and set the time and date, the next morning at 08:00 it was showing 06:00, I set the time again and looked at the clock later that afternoon, now the time was around 14:00 but my bangle was showing around 15:00, I set the time again, it's a few days later and I am writing this at 23:08 and noticed that my Bangle is showing 22:08, something is not right with the internal time keeping thingy, does anyone have any ideas as to what I can do to fix it? :)
-
-
Thank you, certainly I will.
The following image is the "guts" of the project
It's rather simple really, 2 MG90S tower servos are driven directly off a pico board, and powered with a 9V rechargeable battery. The battery can either power both servos and the Pico or just the servos if the Pico is connected to a PC.
Nothing is soldered as I'm still playing around with it.
The "servo arms" parts are just quick mockups that were 3D printed, they weren't perfect so I just used a lighter to reshape them a bit.
The servos are stuck on with double-sided tape, it's very much still in the prototype phase, so nothing has been soldered or in other ways permanently fixed in place xDThe code is also rather simple. I use the typescript project template that can be found here
https://github.com/stasberkov/espruino-ts-quickstart
As my base for the project, I ran into a few issues, for some reason I'm not allowed to put my files in subfolders, which is why they are all just in the root src folder, also I sometimes have to go in and change
require("somefile") to require("somefile.js"), though if I set .js as default I always have to go in and remove it from the built files (which is a bit confusing ... xD)All of my code for the project can be found here, it too is subject to change (a lot) xD
https://github.com/TheLogan/UselessMachine -
-
-
-
I am playing around with a servo.
I get that I can do
const s = require("servo").connect(B14); s.move(0.5, 3000);
This will move the servo to position 0.5 over 3 seconds, however, it doesn't hold the position, so in this case, I am opening a chest, and once the chest is open the weight of it makes the lid slowly close again which is not what I want.
I also get that I can do
analogWrite(pin, (1+pos) / 50.0, {freq:20, soft: false });
This will move the servo to the position taking 1 second and will hold the position, but I can't seem to find a way to set the speed/time by which it moves.
I've tried with interval and moving it a set amount but that results in jaggery movement (I set it with an interval of 20ms, that should not be perceptible, but it was)Does anyone have any ideas of what I should do to get both the speed/time control, and get it to hold the position once it reaches it? :)
I found this tool, it transpiles React live to actual Javascript.
transpiler