Code Monkey home page Code Monkey logo

ai-lego-pixelart-robot's Introduction

AI-LEGO-PixelArt-Robot

This is the code for my AI Lego pixelart robot, as seen on my YouTube channel: https://youtu.be/ec_BtS97IR8

I don't normally use GitHub so please let me know if the way I set things up is incorrect.

The code generates pixelart using OpenAI's Dall-E 3 and controls a Lego Pixelart machine using Mindstorms. It was meant for personal use, so it will not work right away and it will need many changes. I am not updating this project, so libraries like openai might get outdated. This code was last succesfully tested on 6/15/2024.

For use of "main.py"

Some things to note

  • You will need to get your own OpenAI API key and rename the variable in the "imageGenerator.py" file.
  • You will need to change the Bluetooth address of your Mindstorms in the "main.py" file.
  • You can define the usable colors by changing the list "colors_bgr" and "colors_stock" in "main.py" and "recipe" in "imageFunctions.py". They are in the correct order from furthest away from the bed to closest by the bed.
  • You will need to set all the variables that specify motor positions in "main.py" to work with your machine.
  • You will need to define all the motors and sensors correctly in "main.py", with correct ports, speeds and directions.
  • You might need to adjust motor speeds in "ev3Functions.py".

Some things that can be changed

  • You can switch whether you want to use a custom image or use the image generator with the variable "useAI" in "main.py".
  • You can define your object or filepath by renaming the variables in "main.py".
  • You can change the pixelart size by changing the "imgSize" variable in "main.py".
  • "usepixelation" in "main.py" changes the code to either scale images down to the desired size or pick the center point of a grid to create a crisp pixelart.
  • "useOverlay" in "main.py" switches on or off the Lego overlay on the final image.
  • You can define how many usable pixels are in the hoppers, before it prompts you to refill the hoppers, by changing the "color_amount" variable in "main.py".

For use of "main (NO Mindstorms).py"

Some things to note

  • You will need to get your own OpenAI API key and rename the variable in the "imageGenerator.py" file.
  • You can define the usable colors by changing the list "colors_bgr" and "colors_stock" in "main (NO Mindstorms).py" and "recipe" in "imageFunctions.py".

Some things that can be changed

  • You can switch whether you want to use a custom image or use the image generator with the variable "useAI" in "main (NO Mindstorms).py".
  • You can define your object or filepath by renaming the variables in "main (NO Mindstorms).py".
  • You can change the pixelart size by changing the "imgSize" variable in "main (NO Mindstorms).py".
  • "usepixelation" in "main (NO Mindstorms).py" changes the code to either scale images down to the desired size or pick the center point of a grid to create a crisp pixelart.
  • "useOverlay" in "main (NO Mindstorms).py" switches on or off the Lego overlay on the final image.
  • You can define how many usable pixels are in the hoppers, before it prompts you to refill the hoppers, by changing the "color_amount" variable in "main (NO Mindstorms).py".

ai-lego-pixelart-robot's People

Contributors

creativemindstorms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.