Are you new to using CircuitPython? No worries, there is a full getting-started guide here.
Plug the device into your computer with a known good USB cable (not a charge-only cable). The device will appear to your computer in File Explorer or Finder (depending on your operating system) as a flash drive named CIRCUITPY. If the drive does not appear, you can install CircuitPython on your device and then return here.
Download the project files with the Download Project Bundle button below. Unzip the file and copy/paste the code.py and other project files to your CIRCUITPY drive using File Explorer or Finder (depending on your operating system).
Drive Structure
After copying the files, your drive should look like the listing below. It can contain other files as well, but must contain these at a minimum.
# SPDX-FileCopyrightText: 2024 Tim Cocks for Adafruit Industries # # SPDX-License-Identifier: MIT """ Karel the Robot code.py for devices with built-in display available at board.DISPLAY. """ # pylint: disable=wildcard-import, unused-wildcard-import from karel.circuitpythonkarel import * # load a chapter. Edit the chapter filename to change chapters # see available chapter files in chapters/ directory. chapter_data = load_state_file("chapters/karel_ch01.json") def main(): """ Karel main() function declaration. Put your code for Karel into this function. """ ## START OF MAIN FUNCTION, YOUR CODE GOES BELOW HERE ## ## END OF MAIN FUNCTION, YOUR CODE GOES ABOVE HERE ## print(f"Goal state reached? {world.check_goal_state(chapter_data)}") # call the main() function main() # Run forever so that the ending state of Karel and the world # remains visible on the display. while True: pass
Text editor powered by tinymce.