コード例 #1
0
ファイル: main.py プロジェクト: ArtemovSA/ILC_project
def printMorseCharacter(c):
    print "Char " + c,
    if c in morse:
        for s in morse[c]:
            # Some constants, in here because we run out of memory if we put them at the top-level
            ledOn = False if teensyVersion == 1 else True
            ledPin = 6 if teensyVersion == 1 else 1
            ledPort = 'D' if teensyVersion == 1 else 'C'
            dit = 80

            avr.digitalWrite(ledPort, ledPin, ledOn)
            if s == '.':
                print " dit",
                avr.delay(dit)
            elif s == '-':
                print " dah",
                dah = dit * 3
                avr.delay(dah)
            else:
                print " ?",
            avr.digitalWrite(ledPort, ledPin, not ledOn)
            avr.delay(dit)
    else:
        print " ?",
    print
コード例 #2
0
ファイル: main.py プロジェクト: AGM1968/python-on-a-chip
def printMorseCharacter(c):
    print "Char " + c,
    if c in morse:
        for s in morse[c]:
            # Some constants, in here because we run out of memory if we put them at the top-level            
            ledOn = False if teensyVersion == 1 else True
            ledPin = 6 if teensyVersion == 1 else 1
            ledPort = 'D' if teensyVersion == 1 else 'C'
            dit = 80

            avr.digitalWrite(ledPort, ledPin, ledOn)
            if s == '.':
                print " dit",
                avr.delay(dit)
            elif s == '-':
                print " dah",
                dah = dit * 3
                avr.delay(dah)
            else:
                print " ?",            
            avr.digitalWrite(ledPort, ledPin, not ledOn)
            avr.delay(dit)  
    else:
        print " ?",
    print
コード例 #3
0
ファイル: main.py プロジェクト: Nonpython/projects
# This file is Copyright 2007, 2009 Dean Hall.
#
# This file is part of the Python-on-a-Chip program.
# Python-on-a-Chip is free software: you can redistribute it and/or modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
# 
# Python-on-a-Chip is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# A copy of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
# is seen in the file COPYING up one directory from this.

#
# This is a sample application that calls functions in the AVR module.
#
print "Hello world."

import avr


print "Counting from 0 to 249 on portA's pins"

avr.ddrA(0xFF)
i = 0
while i < 250:
    avr.portA(i)
    avr.delay(250)
    i += 1
print "Done."
コード例 #4
0
ファイル: main.py プロジェクト: ArtemovSA/ILC_project
def loop():
    for i in range(1, 6):
        printMorse("SOS")
        avr.delay(1500)
    printMorse("DOES ANYBODY STILL KNOW MORSE CODE?")
    avr.delay(4000)
コード例 #5
0
# This file is Copyright 2007, 2009 Dean Hall.
#
# This file is part of the Python-on-a-Chip program.
# Python-on-a-Chip is free software: you can redistribute it and/or modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
#
# Python-on-a-Chip is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# A copy of the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
# is seen in the file COPYING up one directory from this.

#
# This is a sample application that calls functions in the AVR module.
#
print "Hello world."

import avr

print "Counting from 0 to 249 on portA's pins"

avr.ddrA(0xFF)
i = 0
while i < 250:
    avr.portA(i)
    avr.delay(250)
    i += 1
print "Done."
コード例 #6
0
ファイル: main.py プロジェクト: AGM1968/python-on-a-chip
def loop():
    for i in range(1,6):
        printMorse("SOS")
        avr.delay(1500)
    printMorse("DOES ANYBODY STILL KNOW MORSE CODE?")
    avr.delay(4000)