Had an piece of code in Vexcode V5 Python that was essentially this:
while 1==1:
if line_follower.reflectivity(PERCENT) <27:
turn a motor on and do some other stuff
When we would run the code we could look on the brain under the device info section that has a live display of all currently monitored sensors. Ours had an analog value (can’t remember what) and next to it a percent. When we place a white marble in front of the line follower it always goes lower than 27%, but the commands inside the if statement would not run.
I decided to print the value to the screen to test, so right above the if statement I inserted the line: brain.screen.print(line_follower.reflectivity(PERCENT). It started printing out 70 over and over again, then when we put the white marble in front it printed 81. I adjusted the if statement to account for this and it worked and ran the code inside.
So if line_follower.reflectivity(PERCENT) == 81, why would the percentage be 24% or 25% when looking at the device info for that sensor on the brain? Why are these things different?
Anyone know why these would be different? Thanks.