i'm testing the analog pins of my micro:bit with two light sensors. When I read one pin individual, I get different values depending on the light detected by the sensor. When I read both pins, I get a "fixed" value.
Code Example 1:
Hardware: One Light Sensor. Connected to Pin1 and Ground
Software: Reading only Pin1
Result: Success
Code: Select all
from microbit import *
while True:
pin1.write_digital(1)
sleep(10)
raw = pin1.read_analog()
print("Raw 1: " + str(raw))
print("#########################")
Code Example 2:
Hardware: One Light Sensor. Connected to Pin0 and Ground
Software: Reading only Pin0
Result: Success
Code: Select all
from microbit import *
while True:
pin0.write_digital(1)
sleep(10)
raw = pin0.read_analog()
print("Raw 0: " + str(raw))
print("#########################")
Code Example 3:
Hardware: Two Light Sensors. One Connected to Pin0 and Ground. the other to Pin1 and Ground.
Software: Reading Pin0 and Pin1
Result: Failure. Fixed reading of ~800
Code: Select all
from microbit import *
while True:
pin0.write_digital(1)
pin1.write_digital(1)
sleep(10)
raw0 = pin0.read_analog()
raw1 = pin1.read_analog()
print("Raw 0: " + str(raw0))
print("Raw 1: " + str(raw1))
print("#########################")
On a test with an arduino it worked...so what is the problem? Is there a fix?
Thanks!