Having a great time with my new SparkCores so far. I’m having an issue though.
When I read values from the Tinker firmware, it sets the pin I read to 0.
ex. Set D7 HIGH. The D7 light comes on.
Then digitalread D7. The value comes back LOW and the light turns off.
I get the same behaviour with all digital and analog pins as well.
This is normal. When you change the pin to digitalRead, it is setting the pin as an input which is high impedance. The output circuitry that was high inside the microcontroller is not attached to the pin anymore. Now it’s just reading whatever is on the pin externally. Hope that helps
If you want to set a pin and read it, you can connect one digital output to a different digital input externally with a wire.
Sure! For example, in Tinker you can set D2 to digitalWrite and D6 to digitalRead, hook up your Core like this:
and then anything you set on D2 can be verified with a D6 read (tapping D6 in Tinker). Or for example if D2 was modified by some other curl or HTTP REST request you could know about it by reading D6.
Of course, you can write some nice code that does this with Spark.function() and Spark.variable() but this is a really low tech way of doing the same thing with the out-of-the-box Tinker app and Factory code on the Spark Core.
FYI: A3 and A5 connections are not necessary, and were just for fun