{"id":19815310,"url":"https://github.com/russhughes/classbotlib","last_synced_at":"2026-05-06T16:35:35.923Z","repository":{"id":112293925,"uuid":"131676993","full_name":"russhughes/ClassBotLib","owner":"russhughes","description":"ClassBot Library to control 3d printed drawing robot.","archived":false,"fork":false,"pushed_at":"2019-02-08T05:02:22.000Z","size":3220,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-11-24T03:07:54.024Z","etag":null,"topics":["28byj-48","arduino","drawing","drawing-library","hershey-fonts","plotter","robot"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/russhughes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-01T04:40:30.000Z","updated_at":"2021-11-22T01:35:47.000Z","dependencies_parsed_at":"2023-03-22T08:36:32.873Z","dependency_job_id":null,"html_url":"https://github.com/russhughes/ClassBotLib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/russhughes/ClassBotLib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russhughes%2FClassBotLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russhughes%2FClassBotLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russhughes%2FClassBotLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russhughes%2FClassBotLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/russhughes","download_url":"https://codeload.github.com/russhughes/ClassBotLib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russhughes%2FClassBotLib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32702212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T08:33:17.875Z","status":"ssl_error","status_checked_at":"2026-05-06T08:33:17.221Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["28byj-48","arduino","drawing","drawing-library","hershey-fonts","plotter","robot"],"created_at":"2024-11-12T10:05:30.544Z","updated_at":"2026-05-06T16:35:35.916Z","avatar_url":"https://github.com/russhughes.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n![](https://github.com/russhughes/ClassBotLib/blob/master/doc/images/hello.jpg)\n\n# ClassBotLib\n\nClassBotLib is an arduino library to control a small [3D printed drawing robot](https://www.thingiverse.com/thing:1104889) based on [MakersBox's](https://www.thingiverse.com/MakersBox) [Arduino Chassis for Drawing Robot](https://www.thingiverse.com/thing:1091401). In my classes I use a custom [Arduino Shield](https://easyeda.com/EZG0bble/ClassBot_copy_copy-b2797f6d387242cd86f59364dd86db91) to drive a pair of 28BYJ-48 stepper motors using two ULN2003 driver IC's. The shield has room for a SPI Serial Ram Chip and a I2C Serial EEPROM that are not used in this library.  Take a look at the [TinyBasic Plus ClassBot Edition Github repo](https://github.com/russhughes/TinyBasicPlus) for another way to run the bot.\n\n### Requires the AccelStepper Library:\n- http://www.airspayce.com/mikem/arduino/AccelStepper/\n\n# Using the Library\n\nA #define statement is used to select which of the [Hershey vector fonts](https://en.wikipedia.org/wiki/Hershey_fonts) to use for drawing text. If you do not select a font (or mispell the name of the font) FONT_ROWMANS will be used by default. This must be done before including the \"ClassBot.h\" header file.\n\n    #define FONT_SCRIPTS\n    #include \"ClassBot.h\"\n\n#### Available Hershey fonts\n\n* FONT_ASTROLOGY\n* FONT_CURSIVE\n* FONT_CYRILC\\_1\n* FONT_CYRILLIC\n* FONT_FUTURAL\n* FONT_FUTURAM\n* FONT_GOTHGBT\n* FONT_GOTHGRT\n* FONT_GOTHICENG\n* FONT_GOTHICGER\n* FONT_GOTHICITA\n* FONT_GOTHITT\n* FONT_GREEKC\n* FONT_GREEK\n* FONT_GREEKS\n* FONT_JAPANESE\n* FONT_MARKERS\n* FONT_MATHLOW\n* FONT_MATHUPP\n* FONT_METEOROLOGY\n* FONT_MUSIC\n* FONT_ROWMAND\n* FONT_ROWMANS\n* FONT_ROWMANT\n* FONT_SCRIPTC\n* FONT_SCRIPTS\n* FONT_SYMBOLIC\n* FONT_TIMESG\n* FONT_TIMESIB\n* FONT_TIMESI\n* FONT_TIMESRB\n* FONT_TIMESR\n\n\n## ClassBot\n`ClassBot::ClassBot(int l1 = 9, int l2 = 7, int l3 = 8, int l4 = 6, int r1 = 2, int r2 = 4, int r3 = 3, int r4 = 5, int ServoPin = A0);`\n\nConstructor, create's the ClassBot object and configures the library. Be sure to set your stepper motor pins if your bot is wired differently then the default.\n\n#### Parameters\n| Parameter | Description | Default Value |\n--- | ----------------- | --------\nl1 | left motor pin 1 | D9\nl2 | left motor pin 2 | D7\nl3 | left motor pin 3 | D8\nl4 | left motor pin 4 | D6\nr1 | right motor pin 1 | D2\nr2 | right motor pin 2 | D4\nr3 | right motor pin 3 | D3\nr4 | right motor pin 4 | D5\nServoPin | Pen servo pin | A0\n\n## penDown\n`void penDown();`\n\nLower the pen to the paper.\n\n## penUp\n`void penUp();`\n\nRaise the pen off the paper\n\n## moveForward\n`void moveForward(float distance);`\n\nMove forward `distance` milimeters.\n\n## moveBackward\n`void moveBackward(float distance);`\n\nMove backward `distance` milimeters.\n\n## turnLeft\n`void turnLeft(float degrees);`\n\nTurn `degrees` to the left.\n\n## turnRight\n`void turnRight(float degrees);`\n\nTurn `degrees` to the right.\n\n## turnTo\n`void turnTo(float heading);`\n\nTurn to face `heading` compass heading in degrees.\n\n## moveTo\n`void moveTo(long x, long y, boolean penUp=true, float scale = 1);`\n\nMove to cartesian coordinates `x,y` with the pen up or down as specified by `penUp`. `scale` sets the coordinate size in milimeters and defaults to 1mm.\n\n## drawChar       \n`void drawChar(char ch, float scale = 1);`\n\nDraw the character `ch` at the `scale` size.\n\n## writeText\n`void writeText(char *str, float scale = 1);`\n\nWrite the string `str` at the `scale` size \n\n## done\n`void done();`\n\nTurn off steppers motors and raise the pen.\n\n## setX\n`void setX(long x);`\n\nSet the current cartesian X coordinate to `x`.\n\n## setY\n`void setY(long y);`\n\nSet the current cartesian Y coordinate to `y`.\n\n\n## setH\n`void setH(float degrees);`\n\nSet the current heading in degrees\n\n## getPen\n`boolean getPen();`\n\nReturns true id the pen is raised.\n\n## getX\n`long getX();`\n\nReturn the current cartesian X coordinate of the bot.\n\n## getY\n`long getY();`\n\nReturn the current cartesian Y coordinate of the bot.\n\n## getH\n`float getH();`\n\nReturn the current heading of the bot.\n\n## Example 1: Draw a box\n\n\t//\n\t// Draw a box\n\t//\n\n\t#include \"ClassBot.h\"\n\n\tint side = 20;\n\n\tvoid setup()\n\t{\n   \t\tClassBot bot;\n\n    \tbot.penDown();\n    \tfor (int i=1; i \u003c5; i++) {\n\t\t\tbot.moveForward(side);\n\t\t\tbot.turnLeft(90);\n\t\t}\n  \n\t\tbot.done();\n\t}\n\n\tvoid loop()\n\t{\t\n\t}\n\n## Example 2: Approximate a circle or ellipse using a polygon \n\n\t#include \"ClassBot.h\"\n\n\tint radiusX = 30;\n\tint radiusY = 30;\n\tint sides = 20;\t\t\t// polygon number of sides\n\t\n\tvoid setup()\n\t{\n\t    ClassBot bot;\n\t\n\t    float step = 2 * PI / sides;\n\t    float theta;\n\t\n\t    int x, y, xx, yy;\n\t    \n\t    int startX = bot.getX();\n\t    int startY = bot.getY();\n\t    int startH = bot.getH();\n\t        \n\t    for (theta = 0;  theta \u003c 2 * PI;  theta += step) {\n\t        x = radiusX * cos(theta);\n\t        y = radiusY * sin(theta);\n\t        if (theta == 0) {\n\t            xx = x;\n\t            yy = y;\n\t            bot.moveTo(x, y, true);\n\t        } else {\n\t            bot.moveTo(x, y, false);\n\t        }\n\t    }\n\t    \n\t    bot.moveTo(xx, yy, false);\n\t    bot.moveTo(startX, startY, true);\n\t    bot.turnTo(startH);\n\t\n\t    bot.done();\n\t}\n\t\n\tvoid loop()\n\t{\n\t}\n\n## Example 3: Draw a star\n\t//\n\t// Draw a star\n\t//\n\t\n\t#include \"ClassBot.h\"\n\t\n\tint side = 20;\n\tint points = 5;\n\t\n\tvoid setup()\n\t{\n\t    ClassBot bot;\n\t\n\t    float angle = 180.0 - 180.0 / points;\n\t    int i; \n\t   \n\t    bot.penDown();\n\t    for (i = 0; i \u003c points; i++) {\n\t        bot.moveForward(side);\n\t        bot.turnLeft(angle);\n\t        bot.moveForward(side);\n\t    }\n\t\n\t    bot.done();\n\t}\n\t\n\tvoid loop()\n\t{\n\t}\n\n## Example 4: Write Text\n\n\t//\n\t// Simple text drawing example\n\t//\n\t\n\t// You can use a #define statement to select which font to use\n\t// if you do not select a font (or mispell the name of the font)\n\t// FONT_ROWMANS will be used by default. This must be done before\n\t// the #include \"ClassBot.h\" line.\n\t\n\t#define FONT_SCRIPTS\n\t#include \"ClassBot.h\"\n\t\n\tvoid setup()\n\t{\n\t    ClassBot bot;\n\t\n\t    bot.writeText((char *)\"Hello!\", 2);\n\t    bot.done();\n\t}\n\t\n\tvoid loop()\n\t{\n\t}\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusshughes%2Fclassbotlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frusshughes%2Fclassbotlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusshughes%2Fclassbotlib/lists"}