Vernier Acceleration Sensor Python: Difference between revisions

From wikiluntti
(Created page with "=== Introduction === === Python: Check the modes === <code> #!/usr/bin/env python3 # https://sites.google.com/site/ev3devpython/ from ev3dev2.sensor import * from ev3dev2.s...")
 
No edit summary
Line 3: Line 3:
=== Python: Check the modes ===
=== Python: Check the modes ===


<code>
<syntaxhighlight lang="python">
#!/usr/bin/env python3
#!/usr/bin/env python3
# https://sites.google.com/site/ev3devpython/
# https://sites.google.com/site/ev3devpython/
Line 16: Line 16:
     print( p.modes )
     print( p.modes )
     time.sleep(5)
     time.sleep(5)
</code>
</syntaxhighlight>
Returns the following modes 'ref-raw', 'rgb-raw' and 'col-cal'
Returns the following modes 'ref-raw', 'rgb-raw' and 'col-cal'

Revision as of 19:15, 21 September 2020

Introduction

Python: Check the modes

#!/usr/bin/env python3
# https://sites.google.com/site/ev3devpython/

from ev3dev2.sensor import *
from ev3dev2.sensor import INPUT_1

import time

p = Sensor( INPUT_1 )
while 1:
    print( p.modes )
    time.sleep(5)

Returns the following modes 'ref-raw', 'rgb-raw' and 'col-cal'