コード例 #1
0
ファイル: boot.py プロジェクト: paulo01012018/Follow
# boot.py -- runs on boot-up
# Select which scripts to run, with some extra logic
# > To run 'follow.py':
#       * press reset and do nothing else
# > To run 'dataread.py':
#       * press reset
#       * press user switch and hold until orange LED goes out

import pyb

orange = pyb.LED(3)  # create orange LED object
orange.on()  # indicate we are waiting for switch press
pyb.delay(2000)  # wait for user to maybe press the switch
switch = pyb.Switch()  # create switch object
switch_val = switch()  # sample the switch at end of delay
orange.off()  # indicate that we finished waiting for the switch
blue = pyb.LED(4)  # create blue LED object
blue.on()  # indicate that we are selecting the mode

if switch_val:
    pyb.usb_mode('CDC+MSC')
    pyb.main('dataread.py')  # if switch was pressed, run this
else:
    pyb.usb_mode('CDC+HID')
    pyb.main('pitlStage1.py')  # if switch wasn't pressed, run this

blue.off()  # indicate that we finished selecting the mode
コード例 #2
0
ファイル: boot.py プロジェクト: KULINAR847/MicroPythonChess
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb
pyb.country('US')  # ISO 3166-1 Alpha-2 code, eg US, GB, DE, AU
pyb.main('chess.py')  # main script to run after this one
#pyb.usb_mode('VCP+MSC') # act as a serial and a storage device
#pyb.usb_mode('VCP+HID') # act as a serial device and a mouse
コード例 #3
0
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb
#pyb.main('serial_passtrough.py') # main script to run after this one
pyb.main('lora_test_lowpower_standby.py') # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
コード例 #4
0
'''
If your main function is not named 'main.py', 
the below line is required. 
Replace 'helloWorld.py' with the name of your 
script.
'''

'''
If you're using the MicroPython-Examples github repo,
just uncomment the required line.
'''

#00.Basics/

pyb.main('helloWorld.py') # main script to run after this one


#01.LEDs/

#pyb.main('blink.py') 
#pyb.main('blinkToggle.py') 
#pyb.main('blinkWithoutDelay.py') 
#pyb.main('fade.py') 
#pyb.main('heartbeat.py') 
#pyb.main('heartbeatFade.py') 


#02.Inputs/

#pyb.main('button.py') 
コード例 #5
0
# boot.py -- runs on boot-up
# Let's you choose which script to run.
# > To run 'datalogger.py':
#       * press reset and do nothing else
# > To run 'cardreader.py':
#       * press reset
#       * press user switch and hold until orange LED goes out

import pyb

pyb.LED(3).on()  # indicate we are waiting for switch press
pyb.delay(2000)  # wait for user to maybe press the switch
switch_value = pyb.Switch()()  # sample the switch at end of delay
pyb.LED(3).off()  # indicate that we finished waiting for the switch

pyb.LED(4).on()  # indicate that we are selecting the mode

if switch_value:
    pyb.usb_mode('CDC+MSC')
    pyb.main('cardreader.py')  # if switch was pressed, run this
else:
    pyb.usb_mode('CDC+HID')
    pyb.main('datalogger.py')  # if switch wasn't pressed, run this

pyb.LED(4).off()  # indicate that we finished selecting the mode
コード例 #6
0
ファイル: boot.py プロジェクト: CRImier/MicroPython-modules
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import pyb
pyb.main('main.py') # main script to run after this one
pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
コード例 #7
0
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import pyb
#pyb.main('main.py') # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
pyb.LED(3).on()
pyb.delay(2000)
pyb.LED(4).on()
pyb.LED(3).off()
sw = pyb.Switch()
if sw():
    pyb.usb_mode('CDC+MSC')
    pyb.main('debug_app.py')
else:
    pyb.usb_mode('CDC+HID')
    pyb.main('normal_app.py')
pyb.LED(4).off()
コード例 #8
0
ファイル: boot.py プロジェクト: dguliani/Gaita
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import pyb

pyb.main('imu_logger.py')  # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
コード例 #9
0
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import pyb
# pyb.main('nav_test.py') # main script to run after this one
# pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
# pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
# pyb.main('Final.py') # main script to run after this one
# pyb.main('test.py') # main script to run after this one
# boot.py -- runs on boot-up
pyb.LED(3).on()                 # indicate we are waiting for switch press
pyb.delay(2000)                 # wait for user to maybe press the switch
switch_value = pyb.Switch()()   # sample the switch at end of delay
pyb.LED(3).off()                # indicate that we finished waiting for the switch

pyb.LED(4).on()                 # indicate that we are selecting the mode

if switch_value:
    pyb.usb_mode('CDC+MSC')
    pyb.main('cardreader.py')
else:
    pyb.usb_mode('CDC+HID')
    pyb.main('Final.py')

pyb.LED(4).off()                # indicate that we finished selecting the mode
コード例 #10
0
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import pyb

pyb.usb_mode('CDC+MSC')

#pyb.main('quasar/quasar_main.py')  # main script to run after this on
# pyb.main('turret/turret_main.py')
# pyb.main("tests/lidar_turret_test.py")
#pyb.main("tests/bno055_test.py")
# pyb.main("tests/gps_test.py")
pyb.main("tests/stepper_test.py")
コード例 #11
0
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb
pyb.main('ScaraSingleArmSerialControl.py')  # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
コード例 #12
0
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import pyb
pyb.main('phoneui.py') # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
コード例 #13
0
"""
Entrypoint for pyboard.
"""
import pyb
pyb.country('US')  # ISO 3166-1 Alpha-2 code, eg US, GB, DE, AU
pyb.main('src/main_pyb.py')  # main script to run after this one
pyb.usb_mode('VCP+MSC')  # act as a serial and a storage device
コード例 #14
0
ファイル: boot.py プロジェクト: letouriste001/SmartForest_2.0
#
## REPL over UART
#REPL=pyb.UART(3,115200)
#pyb.repl_uart(REPL)
##os.dupterm(REPL)
#
## USB Mode
#pyb.usb_mode(None)       # Kill serial device
##pyb.usb_mode('CDC')      # Act as a serial device
##pyb.usb_mode('CDC+MSC')  # Act as a serial device and a storage device
##pyb.usb_mode('CDC+HID')  # Act as a serial device and a mouse ** SDCARD **
#
#print('')
#print('********************************')
#print('PYBOARD MICROCONTROLLER')
#print('********************************')
#print('RTC PYBOARD')
#rtc1=pyb.RTC()
#print(rtc1.datetime())
#print('********************************')
#print('RTC DS3231')
#rtc2=DS3231()
#print(rtc2.get_time())
#print('********************************')
#print('')
#
## Main script to run after this one
pyb.main('main.py')
#pyb.main('test.py')
#pyb.main('none.py')
コード例 #15
0
import pyb
from util import *

orange.on()
pyb.delay(1000)
switch = pyb.Switch()
switch_value = switch.value()
orange.off()
# 0 press nothing - go to standby mode (good for pre-deployment) (single red blinker)
# 1 press USR shortly and let go - sampling (orange blinker)
# 2 press USR and keep - go to cardreader mode (single green blinker)
if switch_value:
    blue.on()
    pyb.delay(1000)
    switch_value = switch.value()
    blue.off()
    if switch_value:
        pyb.usb_mode('CDC+MSC')
        blink_led(green)
        pyb.main('cardreader.py')
    else:
        pyb.usb_mode('CDC+HID')
        blink_led(orange)
        pyb.main('datalogger.py')
else:
    #disable wakeup trigger that might've been left from previous setup
    rtc = pyb.RTC()
    rtc.wakeup(None)
    blink_led(red)
    pyb.standby()
コード例 #16
0
# callback scheduled from the interrupt
def poweroff(_):
    for led in leds:
        led.toggle()
    os.sync()
    time.sleep_ms(300)
    pwr.off()
    time.sleep_ms(300)
    # will never reach here
    for led in leds:
        led.toggle()

pyb.ExtInt(pyb.Pin('B1'), pyb.ExtInt.IRQ_FALLING, pyb.Pin.PULL_NONE, pwrcb)

# configure usb from start if you want, 
# otherwise will be configured after PIN
# pyb.usb_mode("VCP+MSC") # debug mode with USB and mounted storages from start
# pyb.usb_mode("VCP") # debug mode with USB from start
# disable at start
# pyb.usb_mode(None)
# os.dupterm(None,0)
# os.dupterm(None,1)

# inject version to platform module
import platform
platform.version = version

# uncomment to run some custom main:
pyb.main("hardwaretest.py")
コード例 #17
0
ファイル: boot.py プロジェクト: turbinenreiter/edurocket
# boot.py -- runs on boot-up
# Let's you choose which script to run.
# > To run 'datalogger.py':
#       * press reset and do nothing else
# > To run 'cardreader.py':
#       * press reset
#       * press user switch and hold until orange LED goes out

import pyb
import sys

pyb.LED(3).on()                 # indicate we are waiting for switch press
pyb.delay(2000)                 # wait for user to maybe press the switch
switch_value = pyb.Switch()()   # sample the switch at end of delay
pyb.LED(3).off()                # indicate that we finished waiting for the switch

pyb.LED(4).on()                 # indicate that we are selecting the mode

if not switch_value:
    pyb.usb_mode('CDC+HID')
    pyb.main('datalogger.py')           # if switch was not pressed, run this
    print('datalogger')
else:
    pyb.main('main.py')           # if switch was pressed, run this
    pyb.usb_mode('CDC+MSC')
    print('main')

pyb.LED(4).off()                # indicate that we finished selecting the mode
コード例 #18
0
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb
pyb.main('simp.py') # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
コード例 #19
0
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb
pyb.main('ScaraSingleArmSerialControl.py') # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
コード例 #20
0
# This file is executed on every boot (including wake-boot from deepsleep)
import micropython
import machine
import pyb
import gc

micropython.alloc_emergency_exception_buf(
    100)  # 设置紧急情况下的(栈溢出,普通RAM不足等)保险RAM分配,使在紧急情况下仍有RAM可用。
machine.freq(168000000)  # 设置CPU频率为168MHz
gc.enable()  # 自动回收内存碎片

pyb.main('main.py')

# https://docs.micropython.org/en/latest/library/pyb.html#pyb.usb_mode
pyb.usb_mode('VCP')  # 仅串口模式,默认串口加硬盘挂载'VCP+MSC'

print(pyb.usb_mode())
コード例 #21
0
ファイル: boot.py プロジェクト: zanran8/air-py
THE SOFTWARE.
"""

# boot.py -- run on boot-up

# import machine
import pyb
from utils.airpy_config_utils import save_config_file, load_config_file

config = load_config_file("app_config.json")
config['serial_only'] = False

boot_delay = 2000

if config['esc_calibration_mode']:  # if esc calibration is true set esc_calibration script to run after this one
    pyb.main('./attitude/esc_calibration.py')
    config['esc_calibration_mode'] = False
    boot_delay = 0  # avoid the boot delay to proceed with esc calibration
else:
    pyb.main('main.py')  # if esc calibration is false set main script to run after this one
    # pyb.main('./aplink/test/test_ap_save_tx_settings.py')  # TEST

pyb.LED(3).on()                 # indicate we are waiting for switch press
pyb.delay(boot_delay)           # wait for user to maybe press the switch
switch_value = pyb.Switch()()   # sample the switch at end of delay
pyb.LED(3).off()                # indicate that we finished waiting for the switch

pyb.LED(4).on()                 # indicate that we are selecting the mode

if switch_value:
    pyb.usb_mode('CDC+MSC')
コード例 #22
0
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb
pyb.main('flight.py')  # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
コード例 #23
0
ファイル: boot.py プロジェクト: felixsc1/COSplay
import path
import pyb
import uos

#switch of laser immediately
pin_out1 = pyb.Pin('Y1', pyb.Pin.OUT_PP, pull=pyb.Pin.PULL_UP)
pin_out1.value(1)
pin_out2 = pyb.Pin('Y3', pyb.Pin.OUT_PP, pull=pyb.Pin.PULL_UP)
pin_out2.value(1)
pin_out3 = pyb.Pin('Y5', pyb.Pin.OUT_PP, pull=pyb.Pin.PULL_UP)
pin_out3.value(1)
pin_out4 = pyb.Pin('Y12', pyb.Pin.OUT_PP, pull=pyb.Pin.PULL_DOWN)
pin_out4.value(0)
pin_out5 = pyb.Pin('Y10', pyb.Pin.OUT_PP, pull=pyb.Pin.PULL_DOWN)
pin_out5.value(0)
pin_out6 = pyb.Pin('X8', pyb.Pin.OUT_PP, pull=pyb.Pin.PULL_DOWN)
pin_out6.value(0)

if path.exists('/flash/bootincopymode'):
    uos.remove('/flash/bootincopymode')
    pyb.usb_mode('VCP+MSC')
    pyb.main('copymodemain.py')
else:
    pyb.usb_mode('VCP')
    pyb.main('main.py')
コード例 #24
0
ファイル: boot.py プロジェクト: pmp-p/micropython-nonlr
# boot.py -- runs on boot-up
# Let's you choose which script to run.
# > To run 'datalogger.py':
#       * press reset and do nothing else
# > To run 'cardreader.py':
#       * press reset
#       * press user switch and hold until orange LED goes out

import pyb

pyb.LED(3).on()  # indicate we are waiting for switch press
pyb.delay(2000)  # wait for user to maybe press the switch
switch_value = pyb.Switch()()  # sample the switch at end of delay
pyb.LED(3).off()  # indicate that we finished waiting for the switch

pyb.LED(4).on()  # indicate that we are selecting the mode

if switch_value:
    pyb.usb_mode("VCP+MSC")
    pyb.main("cardreader.py")  # if switch was pressed, run this
else:
    pyb.usb_mode("VCP+HID")
    pyb.main("datalogger.py")  # if switch wasn't pressed, run this

pyb.LED(4).off()  # indicate that we finished selecting the mode
コード例 #25
0
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb
#pyb.main('serial_passtrough.py') # main script to run after this one
pyb.main('lora_test_lowpower_standby.py')  # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
コード例 #26
0
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb
pyb.main('main_volvox.py')

#pyb.usb_mode('VCP+MSC') # act as a serial and a storage device
#pyb.usb_mode('VCP+HID') # act as a serial device and a mouse
コード例 #27
0
ファイル: boot.py プロジェクト: Woz4tetra/Atlas
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import pyb

pyb.usb_mode('CDC+MSC')

pyb.main('quasar/quasar_main.py')  # main script to run after this on
# pyb.main('turret/turret_main.py')
# pyb.main("tests/lidar_turret_test.py")
# pyb.main("tests/bno055_test.py")
# pyb.main("tests/gps_test.py")
# pyb.main("tests/stepper_test.py")
コード例 #28
0
ファイル: boot.py プロジェクト: SimonWoolf/Mk3-Firmware
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal
# this is a special version for EMF
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse

import pyb
import os
import micropython

micropython.alloc_emergency_exception_buf(100)

m = "bootstrap.py"
if "main.py" in os.listdir():
    m = "main.py"
elif "apps" in os.listdir():
	apps = os.listdir("apps")
	if ("home" in apps) and ("main.py" in os.listdir("apps/home")):
		m = "apps/home/main.py"
	elif ("app_library" in apps) and ("main.py" in os.listdir("apps/app_library")):
		m = "apps/app_library/main.py"
pyb.main(m)
コード例 #29
0
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import pyb

# Ucitavamo led
crvena = pyb.LED(1)             
plava = pyb.LED(4)
zuta = pyb.LED(3)


crvena.on()                     # Palimo led kao oznaku da cekamo da neko pritisne taster   
pyb.delay(2000)                 # Dajemo 2 sekunde da neko pritisne
switch_value = pyb.Switch()()   # Ocitavamo da li je pritisnuto
crvena.off()                    # Gasimo led da bi oznacili kraj izbora moda u kome radi

plava.on()                      # Oznaka da selektujemo mod   

if switch_value:
    #crvena.on()
    pyb.usb_mode('CDC+MSC')     # act as a serial and a storage device
    crvena.on()
    pyb.main('submain1.py')     # Skripta koja se izvrsava ako je taster bio pritisnut
else:
    zuta = pyb.LED(3)
    pyb.usb_mode('CDC+HID')     # act as a serial device and a mouse
    pyb.main('submain2.py')     # Skripta koja se izvrsava ako taster nije bio pritisnut

コード例 #30
0
ファイル: boot.py プロジェクト: woo10e/micropython-keyboard
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import pyb

col1 = pyb.Pin('X9', pyb.Pin.IN, pyb.Pin.PULL_UP)
row1 = pyb.Pin('X19', pyb.Pin.OUT_PP)
row1.low()
pyb.delay(2000)

if not col1.value():
    pyb.usb_mode('CDC+MSC')
    pyb.main('unloop.py')           # if Escape pressed on boot, enable programming mode
else:
    pyb.main('main.py')
    pyb.usb_mode('CDC+HID', hid=pyb.hid_keyboard)

# main script to run after this one
# pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
# pyb.usb_mode('CDC+HID') # act as a serial device and a mouse

コード例 #31
0
ファイル: boot.py プロジェクト: shengzhiheng/pyboard-lock-in
lcd.set_pos(0, 0)
lcd.set_text_color(lcd.rgb(255, 255, 255), lcd.rgb(0, 0, 0))
lcd.set_pen(lcd.rgb(0, 255, 255), lcd.rgb(0, 0, 0))
lcd.set_font(3,0)
lcd.write('INITIALIZED.\n')
lcd.set_pos(0, 20)
lcd.write('Welcome.')
lcd.set_pos(0, 40)
lcd.write('Touch to read data')

red.on()
# wait 1000 ms for the switch to be pressed and hold.
pyb.delay(1000)
sw = pyb.Switch()()
# press the switch or screnn to activate as storage device
# leave unpressed to collect data
# this way the data file will not be affected by Windows
if (sw or lcd.is_touched()):
    # usb mode of storage device
    pyb.usb_mode('CDC+MSC')
    pyb.main('card-reader.py')
    lcd.erase()
    lcd.set_pos(0,0)
    lcd.write('Cardreader mode')
else:
    # in this mode, files will not be visible in Windows
    pyb.usb_mode('CDC+HID')
    pyb.main('fourier-analyzer.py')

red.off()
コード例 #32
0
ファイル: boot.py プロジェクト: MIEMHSE/spiritlevel
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import pyb
pyb.main('spiritlevel.py') # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
コード例 #33
0
ファイル: boot.py プロジェクト: shengzhiheng/pyboard-lock-in
lcd.set_text_color(lcd.rgb(255, 255, 255), lcd.rgb(0, 0, 0))
lcd.set_pen(lcd.rgb(0, 255, 255), lcd.rgb(0, 0, 0))
lcd.set_font(3,0)
lcd.write('INITIALIZED.\n')
lcd.set_pos(0, 20)
lcd.write('Welcome.')
lcd.set_pos(0, 40)
lcd.write('Touch to read data')

red.on()
# wait 1000 ms for the switch to be pressed and hold.
pyb.delay(1000)
sw = pyb.Switch()()
# press the switch to activate as storage device
# leave unpressed to collect data
# this way the data file will not be affected by windows
if (sw or lcd.is_touched()):
    # usb mode of storage device
    pyb.usb_mode('CDC+MSC')
    pyb.main('card-reader.py')
    # cardreader.py can be empty
    lcd.erase()
    lcd.set_pos(0,0)
    lcd.write('Cardreader mode')
else:
    # in this mode, files will not be visible in windows
    pyb.usb_mode('CDC+HID')
    pyb.main('lock-in-amplifier.py')

red.off()
コード例 #34
0
ファイル: boot.py プロジェクト: kanzure/culture_shock
# boot.py -- run on boot-up
import machine
import pyb
pyb.usb_mode('VCP') # act as a serial and not as a storage device
pyb.main('pulser_main.py')
コード例 #35
0
ファイル: boot.py プロジェクト: kanzure/culture_shock
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb
pyb.freq(96000000)
pyb.main('hv_pulser.py')  # main script to run after this one
# pyb.usb_mode('CDC+MSC')  # act as a serial and a storage device
# pyb.usb_mode('CDC+HID')  # act as a serial device and a mouse
コード例 #36
0
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import pyb
import os, sys

#pyb.main('main.py') # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse

if pyb.SDCard().present():
    pyb.usb_mode('VCP+MSC', msc=(pyb.SDCard(), ))  # expose SD card to the PC

    os.mount(pyb.SDCard(), '/sd')
    sys.path[1:1] = ['/sd', '/sd/lib']
    print("SD Mounted")

if pyb.SDCard().present():
    # Try starting from the SD card
    pyb.main('/sd/smain.py')  # main script to run after this one
    print("Started /sd/smain.py")
else:
    # If that fails (no SD card), start the flash
    pyb.main('/flash/main.py')  # main script to run after this one
    print("Started /flash/main.py")
コード例 #37
0
ファイル: boot.py プロジェクト: morgulbrut/LoRa-Stuff
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb
pyb.main('gps_logger.py') # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
コード例 #38
0
import pyb
pyb.usb_mode('CDC+MSC')  # act as a serial and a storage device
pyb.main('ucode.py')  # main script to run after this one
コード例 #39
0
ファイル: boot.py プロジェクト: Furrane/pybstick-projects
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb

run_pin = machine.Pin("S22", machine.Pin.IN, machine.Pin.PULL_UP)

# run_pin = Low - Normal PYBStick operation
if run_pin.value() == 0:
    # Périphérique de stockage et port serie
    pyb.usb_mode('VCP+MSC')  # act as a serial and a storage device
    # ne pas executer main.py
    pyb.main('nomain.py')  # main script to run after this one
else:
    # Agir comme un clavier uniquement
    pyb.usb_mode('VCP+HID',
                 hid=pyb.hid_keyboard)  # Clavier + port série pour debug
    # pyb.usb_mode('VCP+HID', hid=pyb.hid_mouse) # Souris + port série pour debug
    pyb.main('keybow3.py')
コード例 #40
0
import machine
import pyb

pyb.main('main.py')  # main script to run after this one
コード例 #41
0
ファイル: boot.py プロジェクト: ekohilas/rubber-snek
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb

pyb.main('translator.py')  # main script to run after this one
#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
pyb.usb_mode('CDC+HID',
             hid=pyb.hid_keyboard)  # act as a serial device and a mouse
コード例 #42
0
ファイル: boot.py プロジェクト: MattJFanguy/ARLISS
    Adafruit Ultimate GPS
    Sparkfun Razor IMU
    XBee Pro with sparkfun breakout board
    210 RPM Gearmotor With 48 CPR Encoders
    md07a High-power Pololu Motor Drivers
    '''

################## Importing Necessary files ###############
import pyb
'''from pyb import UART
from pyboard_razor_IMU import Razor
from pyb import Pin
from micropyGPS import MicropyGPS
from motor import motor
import time
import math
'''
#Light Sequence Distinguishing setup is in progress
pyb.LED(3).on()
pyb.delay(2000)
pyb.LED(3).off()
pyb.LED(4).on()

# Running main.py after setup is finished
pyb.usb_mode(
    'CDC+MSC')  #Setup for quick diagnostic via usb cable to REPL prompt
pyb.main('main.py')  #Run the main process after boot has finished

#Indicate that setup has been completed
pyb.LED(4).off()
コード例 #43
0
ファイル: boot.py プロジェクト: mer0m/stm32
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import machine
import pyb
pyb.main('STM32_controller.py')  # main script to run after this one

#pyb.usb_mode('CDC+MSC') # act as a serial and a storage device
#pyb.usb_mode('CDC+HID') # act as a serial device and a mouse
コード例 #44
0
ファイル: boot.py プロジェクト: Achimh3011/micropython
# boot.py -- runs on boot-up
# Let's you choose which script to run.
# > To run 'datalogger.py':
#       * press reset and do nothing else
# > To run 'cardreader.py':
#       * press reset
#       * press user switch and hold until orange LED goes out

import pyb

pyb.LED(3).on()                 # indicate we are waiting for switch press
pyb.delay(2000)                 # wait for user to maybe press the switch
switch_value = pyb.Switch()()   # sample the switch at end of delay
pyb.LED(3).off()                # indicate that we finished waiting for the switch

pyb.LED(4).on()                 # indicate that we are selecting the mode

if switch_value:
    pyb.usb_mode('VCP+MSC')
    pyb.main('cardreader.py')           # if switch was pressed, run this
else:
    pyb.usb_mode('VCP+HID')
    pyb.main('datalogger.py')           # if switch wasn't pressed, run this

pyb.LED(4).off()                # indicate that we finished selecting the mode
コード例 #45
0
ファイル: boot.py プロジェクト: Woz4tetra/Atlas
# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

import pyb

pyb.usb_mode('CDC+MSC')

# pyb.main('quasar/quasar_main.py')  # main script to run after this on
# pyb.main('turret/turret_main.py')
# pyb.main("tests/lidar_turret_test.py")
pyb.main("tests/bno055_test.py")
# pyb.main("tests/gps_test.py")
# pyb.main("tests/stepper_test.py")
コード例 #46
0
micropython.alloc_emergency_exception_buf(100)

os.sync()
root = os.listdir()

def app(a):
    if (a in root) and ("main.py" in os.listdir(a)):
        return a + "/main.py"

def file(file, remove):
    print(file)
    try:
        a = None
        with open(file, 'r') as f:
            a = f.read().strip()
        if remove:
            os.remove(file)
        return app(a)
    except Exception as e:
        print(e)

def any_home():
    return app(next(a for a in root if a.startswith("home")))

start = None
if "main.py" in root:
    start = "main.py"
start = file("once.txt", True) or file("default_app.txt", False) or any_home() or "bootstrap.py"

pyb.main(start)
コード例 #47
0
ファイル: boot.py プロジェクト: kanzure/culture_shock
# boot.py -- run on boot-up

import machine
import pyb
pyb.freq(84000000)
pyb.main('pintest.py')