LED1.write(1); save(); didn't save LED1 state after power off. why? #3470
Replies: 24 comments
-
Posted at 2013-12-05 by @gfwilliams This is expected behaviour. If you want to force LED1 on at startup, do:
I'd been considering saving pin state, but I'm not sure if it's such a good idea as often connected devices will actually need more complex initialisation done to them than just setting pin state back exactly as it was. I think very often it's actually better to force people to explicitly set the pin state. I'd be interested to hear what everyone thinks though. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-05 by Andrey Thanks a lot! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-06 by jlawson I suggest NOT saving pin states; at least as a "by default" operation. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-13 by @gfwilliams It's actually been added now - sorry. That's the problem, you can't keep everyone happy. In the case of I2C/SPI/OneWire it's fine as they are ignored (and the relevant SPI setup command is added) - it is only when you've set a pin as a simple output or have added pullup/pulldowns to an input. For beginners, there is something nice about saying |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-13 by jlawson No worries Gordon. It doesn't make me any less happy than I was :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-14 by Andrey Gordon, I've uploaded:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-14 by Andrey update: moved to the Ver1.44. - everything the same. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-16 by @gfwilliams See this post: http://forum.espruino.com/conversations/252/#comment3791 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by Andrey Hi, Gordon, |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by @gfwilliams Hi Andrey, Your initial suggestion should now work as well. What happens when you connect to the device with the Web UI? Does the LED light up? If you're plugged into the PC then Espruino knows it is connected to a device and has to wait until the device reads the text it's trying to send on bootup (which means it won't run your code immediately). If you're connected to a battery (or even a USB phone charger) then that shouldn't happen. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by Andrey Yea, It lights immediately after downloading. i use VLDISCOVERY board and supply it from the USB-TTL converter. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by @gfwilliams I'm not sure I understand... So you
There shouldn't be an issue when connected over USB-TTL. I actually have the board beside me that I used to find the problem. I plugged it in and LED1 lit right away... |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by Andrey I write code pasted above, download, LED1 lights, after power off-on It doesn't light. I connect web IDE LED1 doesn't light. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by @gfwilliams Do you press enter after the I've just downloaded the image from https://espruino-nightly.noda.se/2013-12-17/stm32vldiscovery/espruino_1v44_stm32vldiscovery.bin, and done exactly as you say, and it works. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by Andrey sure...I tryed to include save(); on right panel, also tryed to put save() and enter - no effect.. =undefined
OMG!!! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by @gfwilliams Did it say 'OMG'? Putting save() in the right-hand panel isn't really a good idea, but it should work in the left. After having reset, if you type |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by Andrey no, no, 'OMG' is my own addition, sorry. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by @gfwilliams :) Thought not, but you never know! Ok, looks like it's not loading the code that you saved to it. When it boots, does it say Can you try typing |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by Andrey No it doesn't, It says:
and
after reset button. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by Andrey ok, It starts working after |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by @gfwilliams Hi Andrey, I don't know how, but you've got the blue button stuck down. When you press the blue button during reset/power up, Espruino doesn't load the saved program, so that you can recover if you save something that stops Espruino working. It says so here: http://www.espruino.com/Reference#l__global_save |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-17 by Andrey Gordon, I didn't say about It, because I didn't think that is affects, but i have LCD pin connected to A0. Yes, I'm an Idiot. Because of my stupidity, I stole a lot of your time. Sorry, I'm sorry. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-18 by @gfwilliams No problem, good to hear it's not a software problem. P.S. The STM32VLDISCOVERY has the lowest amount of memory of any board that Espruino runs on - you might find that if you're adding things like LCD screens, you soon run out of available memory. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2013-12-18 by @gfwilliams Just wanted to say, if you look at the reference page for your board, eg: http://www.espruino.com/ReferenceSTM32VLDISCOVERY The pins with purple by them are ones that you should try not to use, as they are connected to other things. It's not such a big deal on the VL board, but on boards like the F3 and F4 that have accelerometers and things, it's really handy to know what pins are already in use :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2013-12-04 by Andrey
but
var1=true;
save();
saves var1.....
Beta Was this translation helpful? Give feedback.
All reactions