If the watch crystal is working properly, it should return 'LSE', but if not it'd return 'LSI'.
The fading shouldn't interfere with the RTC at all... You're using setInterval there, which should be absolutely fine - but you can now actually use the Date class and clock module if you want to. It means that you don't have to keep track of time every second if you don't want to, and you get the day of the week/etc too:
var Clock = require("clock").Clock;
var clk=new Clock("Jun 23, 2014 12:18:02");
// every time the button is pressed, print the current time..
setInterval(function() {
var d=clk.getDate();
// you can then use d.getHours() and g.getMinutes()
}, 10000/*or whatever*/);
As far as the non-linear fading, I'm not sure. Is it not just that the light you're using is itself non-linear? For instance I believe that if you have an LED, pulsing it at 10% duty cycle will probably generate more than 10% of the light that you'd get by running it at 100% duty cycle.
You might also find that specifying a frequency when using analogWrite would help out with that: analogWrite(port.pin,port.brightness,{freq:500});
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
It sounds a lot like you're still working off the internal oscillator... That kind of accuracy is what you'd expect from it.
Can you try copying and pasting this into the console?
If the watch crystal is working properly, it should return 'LSE', but if not it'd return 'LSI'.
The fading shouldn't interfere with the RTC at all... You're using setInterval there, which should be absolutely fine - but you can now actually use the Date class and clock module if you want to. It means that you don't have to keep track of time every second if you don't want to, and you get the day of the week/etc too:
As far as the non-linear fading, I'm not sure. Is it not just that the light you're using is itself non-linear? For instance I believe that if you have an LED, pulsing it at 10% duty cycle will probably generate more than 10% of the light that you'd get by running it at 100% duty cycle.
You might also find that specifying a frequency when using
analogWrite
would help out with that:analogWrite(port.pin,port.brightness,{freq:500});