Sometimes it's nice having the internal pullup resistors set on the
input pins, such as when you're using a simple bumper switch, but
sometimes it messes things up, such as when you're trying to read an
analog voltage level. We've discussed keeping it as is, which is
sometimes handy & sometimes not, and removing them, which again is
sometimes handy & sometimes not, and we've also discussed having some
kind of initializing statement, which would solve the issue, but adds
complexity and requires the Blocos people to change their software. I
think there may be another solution. We already have two sensor input
commands, Switch and Sensor. What if we leave the pullups on by default
and the Switch command unchanged; Switch would act as a digital input.
Then change the firmware so that whenever it executes a Sensor read, it
first switches off the pullup resistor, performs the analog read, and
then switches the pullup resistor back on. This would give us digital
inputs via Switch, accurate analog measurements via Sensor, and even
allows the same pin to be read digitally or as analog within the same
user program. All of this with a relatively simple change in firmware
and requiring no changes in the programming environment software.
Will this work??
Brett