Skip to content

Commit

Permalink
Beta 3
Browse files Browse the repository at this point in the history
  • Loading branch information
RetiredWizard committed Apr 19, 2023
1 parent 1bab9f9 commit 3afc645
Show file tree
Hide file tree
Showing 97 changed files with 2,151 additions and 1,627 deletions.
2 changes: 1 addition & 1 deletion 3.aut
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@echo off
del autoexec.bat
if exist _PyDexec._PyD rename _PyDexec._PyD autoexec.bat
if exist _autoexec._PyD rename _autoexec._PyD autoexec.bat
type menu.txt
4 changes: 3 additions & 1 deletion 3.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@echo off
if exist autoexec.bat copy/y autoexec.bat _PyDexec._PyD
if exist _autoexec._PyD goto skip
if exist autoexec.bat rename autoexec.bat _autoexec._PyD
:skip
copy/y 3.aut autoexec.bat
runvm /PyBasic/PyBasic adventure-fast.pgm
menu.bat
16 changes: 10 additions & 6 deletions PyBasic/basicparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
pass
try:
from pydos_hw import sndPin as hwsndPin
from pydos_hw import sndGPIO, quietSnd
from pydos_hw import Pydos_hw, quietSnd
sndPin = hwsndPin
except:
sndPin = None
Expand Down Expand Up @@ -124,15 +124,19 @@ def __init__(self):
#file handle list
self.__file_handles = {}

self.__pwm = None
if implementation.name.upper() == 'MICROPYTHON':
if sndPin:
try:
self.__pwm = PWM(sndPin,freq=0)
except:
self.__pwm = PWM(sndPin)
try:
self.__pwm = PWM(sndPin)
except:
pass
if 'duty_u16' in dir(self.__pwm):
self.__pwm.duty_u16(0)
else:
elif 'duty' in dir(self.__pwm):
self.__pwm.duty(0)


Expand Down Expand Up @@ -893,7 +897,7 @@ def __soundstmt(self):
volume = 800

if implementation.name.upper() == 'MICROPYTHON':
if sndPin:
if sndPin and self.__pwm:
self.__pwm.freq(freq)
if "duty_u16" in dir(self.__pwm):
self.__pwm.duty_u16(volume)
Expand All @@ -906,8 +910,8 @@ def __soundstmt(self):
elif implementation.name.upper() == 'CIRCUITPYTHON':
if sndPin:
try:
sndGPIO.deinit() # Workaround for ESP32-S2 GPIO issue
audioPin = PWMOut(sndPin, duty_cycle=volume, frequency=freq, variable_frequency=True)
Pydos_hw.sndGPIO.deinit() # Workaround for ESP32-S2 GPIO issue
audioPin = PWMOut(sndPin, duty_cycle=volume, frequency=freq)
sleep(duration/18.2)
audioPin.deinit()
quietSnd() # Workaround for ESP32-S2 GPIO issue
Expand Down
19 changes: 19 additions & 0 deletions PyBasic/fractal.bas
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
10 FOR Y = - 12 TO 12
20 FOR X = - 39 TO 30
30 CA = X * 0.0458
40 CB = Y * 0.08333
50 A = CA
60 B = CB
70 FOR I = 0 TO 15
80 T = A * A - B * B + CA
90 B = 2 * A * B + CB
100 A = T
110 IF ( A * A + B * B ) > 5 THEN GOTO 200
120 NEXT I
130 PRINT " " ;
140 GOTO 210
200 IF I > 9 THEN I = I + 7
205 PRINT CHR$ ( 48 + I ) ;
210 NEXT X
220 PRINT
230 NEXT Y
Loading

0 comments on commit 3afc645

Please sign in to comment.