So you're saying that even without analogRead, you can't use D0?
For analogRead, I think this would be an issue on any board - internally, the pin can only be connected to one peripheral at a time - eg, SPI, I2C, Serial, GPIO, or Analog.
So you've got it set to digital input for setWatch, but then when you read the analog value with analogRead, the pin is disconnected from the input and turned into an analog input - which is probably what causes the state change for the watch.
As @allObjects says you might be able to force it with pinMode, but it's quite possible that analogRead won't work on the pin after that
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.
So you're saying that even without
analogRead
, you can't useD0
?For
analogRead
, I think this would be an issue on any board - internally, the pin can only be connected to one peripheral at a time - eg, SPI, I2C, Serial, GPIO, or Analog.So you've got it set to digital input for
setWatch
, but then when you read the analog value withanalogRead
, the pin is disconnected from the input and turned into an analog input - which is probably what causes the state change for the watch.As @allObjects says you might be able to force it with
pinMode
, but it's quite possible thatanalogRead
won't work on the pin after that