trimchess

portenta-python-main.py

Oct 17th, 2020
431
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #I built a main.py with some Python commands in a forever loop. As long as I start ist from the OpenMV IDE, it is running fine (with #the procedure written in the tutorial).
  2.  
  3. # Main Module Example
  4.  
  5. import pyb, time, os
  6.  
  7. ctr = 0
  8.  
  9. led1 = pyb.LED(1) #red LED
  10. led2 = pyb.LED(2) #green LED
  11. led3 = pyb.LED(3) #blue LED
  12.  
  13. while(1):
  14.     print('looping the thing {}...'.format(ctr))      
  15.     ctr += 1
  16.     now = pyb.micros()
  17.     print('/ {}'.format(os.listdir('/')))
  18.     now2 = pyb.micros()
  19.     print('Time needed to print the System Volume Info {} micro seconds'.format(now2 - now))
  20.     led1.toggle()
  21.     pyb.delay(2000)
  22.     led1.toggle()
  23.     pyb.delay(2000)
  24.     led2.on()
  25.     pyb.delay(2000)
  26.     led2.off()
  27.     pyb.delay(500)
  28.     led3.on()
  29.     pyb.delay(500)
  30.     led3.off()
  31.     pyb.delay(500)
  32.     for i in range(0,6):
  33.         print(i)
  34.  
RAW Paste Data