You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Library modules through 0.3.4 do not leave enough room to add subsystems to existing apps. For example, adding frequency_out to the IR remote example below causes a memory error, as does adding breadboard LED control to Roaming with Whiskers (also below).
Use Mu and parallax.py module
Remove the # from bot(22).frequency_out... and flash.
Click REPL and then press CTRL+D to enter restart with serial debugging.
REPL displays "Traceback (most recent call last): File "main", line 6 (or 3), in MemoryError:"
# IR_Remote_Control_Expanded.py
from parallax import *
# Adding this made the code too large.
# bot(22).frequency_out(300, 2000)
while True:
num = bot(2).tv_remote()
# Forward on button press 1
if num == 1:
bot(18).servo_speed(0)
bot(19).servo_speed(-75)
display.show(Image.ARROW_SE)
elif num == 2:
bot(18).servo_speed(75)
bot(19).servo_speed(-75)
display.show(Image.ARROW_S)
elif num == 3:
bot(18).servo_speed(75)
bot(19).servo_speed(0)
display.show(Image.ARROW_SW)
elif num == 4:
bot(18).servo_speed(-75)
bot(19).servo_speed(-75)
display.show(Image.ARROW_E)
elif num == 5:
bot(18).servo_speed(0)
bot(19).servo_speed(0)
display.show(Image.HAPPY)
elif num == 6:
bot(18).servo_speed(75)
bot(19).servo_speed(75)
display.show(Image.ARROW_W)
elif num == 7:
bot(18).servo_speed(0)
bot(19).servo_speed(75)
display.show(Image.ARROW_NE)
elif num == 8:
bot(18).servo_speed(-75)
bot(19).servo_speed(75)
display.show(Image.ARROW_N)
elif num == 9:
bot(18).servo_speed(-75)
bot(19).servo_speed(0)
display.show(Image.ARROW_NW)
# Whiskers_Roam_Expanded.py
from parallax import *
bot(22).frequency_out(300, 2000)
while True:
left = bot(7).digital_read()
right = bot(9).digital_read()
if left == 1 and right == 1: #Go forward
bot(18).servo_speed(75)
bot(19).servo_speed(-75)
display.show(Image.ARROW_S)
bot(15).write_digital(0)
bot(0).write_digital(0)
elif left == 1 and right == 0: #Obstacle on right
bot(18).servo_speed(-75) #back up for 1s, turn left
bot(19).servo_speed(75)
display.show(Image.ARROW_N)
bot(15).write_digital(0)
bot(0).write_digital(1)
sleep(1000)
bot(18).servo_speed(-75)
bot(19).servo_speed(-75)
display.show(Image.ARROW_E)
sleep(600)
elif left == 0 and right ==1: #Obstacle on left
bot(18).servo_speed(-75) #backup for 1s, turn right
bot(19).servo_speed(75)
display.show(Image.ARROW_N)
bot(15).write_digital(1)
bot(0).write_digital(0)
sleep(1000)
bot(18).servo_speed(75)
bot(19).servo_speed(75)
display.show(Image.ARROW_W)
sleep(600)
elif left == 0 and right == 0: #Obstacle on left + right
bot(18).servo_speed(-75) #backup for 1s, turn
bot(19).servo_speed(75)
display.show(Image.ARROW_N)
bot(15).write_digital(1)
bot(0).write_digital(1)
sleep(1000)
bot(18).servo_speed(75)
bot(19).servo_speed(75)
display.show(Image.ARROW_W)
sleep(1000)
The text was updated successfully, but these errors were encountered:
The difference appears to be significant. I was able to add 23 frequency_out calls to IR_Remote_Control_Expanded.py. Also, the max number of maneuvers in Navitate_Routine_Long.py increased from 35 to 95. (Correction: 37 to 95.)
Library modules through 0.3.4 do not leave enough room to add subsystems to existing apps. For example, adding frequency_out to the IR remote example below causes a memory error, as does adding breadboard LED control to Roaming with Whiskers (also below).
The text was updated successfully, but these errors were encountered: