7. 부록1 - 거북이 로봇: 파이선과 엔트리 파이선 명령어 비교하기
1left_wheel(speed), right_wheel(speed) 명령어
from roboid import *
turtle=Turtle()
turtle.left_wheel(40)
turtle.right_wheel(40)
import Entry
import Turtle
def when_start():
Turtle.left_wheel(40)
Turtle.right_wheel(40)
2move_forward(cm), move_backward(cm) 명령어
from roboid import *
turtle=Turtle()
turtle.move_forward(8)
turtle.move_backward(8)
import Entry
import Turtle
def when_start():
Turtle.move_forward(8, Turtle.UNIT_CM)
Turtle.move_backward(8, Turtle.UNIT_CM)
3turn_left(degree), turn_right(degree) 명령어
from roboid import *
turtle=Turtle()
turtle.turn_left(45)
turtle.turn_right(45)
import Entry
import Turtle
def when_start():
Turtle.turn_left(45, Turtle.UNIT_DEG)
Turtle.turn_right(45, Turtle.UNIT_DEG)
4sound(sound_id), sound_until_done(sound_id)
from roboid import *
turtle=Turtle()
turtle.sound(Turtle.SOUND_SIREN)
turtle.sound_until_done(Turtle.SOUND_SIREN)
import Entry
import Turtle
def when_start():
Turtle.sound(Turtle.SOUND_SIREN, 1)
Turtle.sound_until_done(Turtle.SOUND_SIREN, 1)
5note(pitch, beats)
from roboid import *
turtle=Turtle()
turtle.note(Turtle.NOTE_A_4, 0.5)
import Entry
import Turtle
def when_start():
Turtle.note(Turtle.NOTE_A, 4, 0.5)