All Projects → tinkersprojects → G-Code-Arduino-Library

tinkersprojects / G-Code-Arduino-Library

Licence: GPL-3.0 license
Allows any machines and robots to be controlled by G-Code

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to G-Code-Arduino-Library

vscode-gcode-syntax
G Code Language Extension for Visual Studio Code. Turn VSCode into a fully capable G-Code editor, including language support & more.
Stars: ✭ 59 (+34.09%)
Mutual labels:  machine, cnc
IndyMill
Open Source DIY Metal CNC Machine
Stars: ✭ 85 (+93.18%)
Mutual labels:  machine, cnc
Makelangelo Firmware
CNC firmware for many different control boards and kinematic systems. Originally the brain of the Makelangelo art robot.
Stars: ✭ 116 (+163.64%)
Mutual labels:  robot, cnc
Kinematics
🤖 JavaScript 6DOF robot kinematics library
Stars: ✭ 187 (+325%)
Mutual labels:  robot
Pybotics
The Python Toolbox for Robotics
Stars: ✭ 192 (+336.36%)
Mutual labels:  robot
Spatio temporal voxel layer
A new voxel layer leveraging modern 3D graphics tools to modernize navigation environmental representations
Stars: ✭ 246 (+459.09%)
Mutual labels:  robot
Adafruit MCP3008
MCP3008 8-Channel 10-Bit ADC
Stars: ✭ 22 (-50%)
Mutual labels:  arduino-library
Plen2
The world's first printable open-source humanoid, starter kit.
Stars: ✭ 175 (+297.73%)
Mutual labels:  robot
Adafruit TLC59711
Arduino library for TLC59711
Stars: ✭ 20 (-54.55%)
Mutual labels:  arduino-library
Ros robotics projects
Example codes of new book ROS Robotics Projects
Stars: ✭ 240 (+445.45%)
Mutual labels:  robot
Automagica
AI-powered Smart Robotic Process Automation 🤖
Stars: ✭ 2,610 (+5831.82%)
Mutual labels:  robot
Wall.e
A javaScript robot which looks like WALL.E
Stars: ✭ 201 (+356.82%)
Mutual labels:  robot
arduino-id-guard
Tiny library to avoid deploying your sketch to wrong device.
Stars: ✭ 21 (-52.27%)
Mutual labels:  arduino-library
Rest980
REST interface to control your iRobot Roomba 980 via local server on your lan.
Stars: ✭ 186 (+322.73%)
Mutual labels:  robot
GPT2-Telegram-Chatbot
GPT-2 Telegram Chat bot
Stars: ✭ 67 (+52.27%)
Mutual labels:  machine
Robot Gui
A three.js based 3D robot interface.
Stars: ✭ 181 (+311.36%)
Mutual labels:  robot
BipedalWalkingRobots
Linear Inverted Pendulum Model based bipedal walking
Stars: ✭ 67 (+52.27%)
Mutual labels:  robot
Pypot
Python library for controlling dynamixel motors. Documentation available here:
Stars: ✭ 226 (+413.64%)
Mutual labels:  robot
Chatapi Wechat
Java版本微信聊天接口,使用网页微信API,让你能够开发自己的微信聊天机器人
Stars: ✭ 207 (+370.45%)
Mutual labels:  robot
Makelangelo Software
Software for plotters - especially the wall-hanging polargraph also called Makelangelo.
Stars: ✭ 248 (+463.64%)
Mutual labels:  robot

G-Code Arduino Library

https://tinkersprojects.com/
This is a library that alows any machine or robot to be controlled by G-Code

Features

  • serial or character input
  • Customisable

What is G-Code?

G-Code is the instructions that 3D Printer and CNC used to create there part. G-Code is a set of instruction commands sent to the controller of the machine to be performed. Position, feed rate, and tool used are some of the items that G-Code can control. The G-Code can either be sent from the computer or saved on an SD card.

Why make this library?

This library allows any machine or robot to be controlled by G-Code. It makes it quick and easy to set up with CNC and machine software and gives much better control over the communications and commands.

Why use this?

If your project requires computer control or a set of instruction, a library like this will help simplify this process of making it your self.

Functions

SETUP

gcode(),
gcode(void (*CallBack)()),
gcode(int numbercommands, commandscallback *commandArray),
gcode(int numbercommands, commandscallback *commandArray, void (*CallBack)());

This Function is used to declare this class so that it can be used in the program. There are 4 different functions, each with variables that can be set. The callback is used to link a call back function used after each command is available. commandArray is an array of callback that interupt the program to execute the command. Numbercommands is the number of items within commandArray.

void begin(),
void begin(unsigned long baud)

This Function must be called if the serial interface is wanting to be used. Bitrate is the bitrate of the serial port. If this is called, there is no need to Serial.begin();, it is apart of the begin function.

SEND

void comment(String comment)

This Function is to send comments back through the serial. Comment would be the comment that would be sent back.

RECEIVE

bool available(),
bool available(char inChar)

This function reads the incoming data and returns true then the command is ready to for the program to read an control the machine. InChar is the input from a source like an SD card.

double GetValue(char commandLetter)

This function is to return the values for a command letter. CommandLetter is the command letter that is requested to be returned.

Example

Example 1: LED_Control

#include <gcode.h>

#define LEDpin 13
#define NumberOfCommands 2

void homing();
commandscallback commands[NumberOfCommands] = {{"L1",OnLED},{"L2",OffLED}};
gcode Commands(NumberOfCommands,commands);

void setup()
{
  Commands.begin();
  pinMode(LEDpin, OUTPUT);
}

void loop() 
{
  Commands.available();
}

void OnLED()
{
  digitalWrite(LEDpin, HIGH);
}

void OffLED()
{
  digitalWrite(LEDpin, LOW);
}

Example 2: simplePloter

#include <gcode.h>

void homing();
commandscallback commands[1] = {{"G28",homing}};
gcode Commands(1,commands);

double X;
double Y;

void setup()
{
  Commands.begin();
}

void loop() 
{
  if(Commands.available())
  {
    double newXValue = X;
    double newYValue = Y;
    
    if(Commands.availableValue('X'))
      newXValue = Commands.GetValue('X');
    if(Commands.availableValue('Y'))
      newYValue = Commands.GetValue('Y');

    gotoLocation(newXValue,newYValue);
  }
}

void homing()
{
  // code to home machine
}

void gotoLocation(double x,double y)
{
  // code to run machine to location
}

Example 3: CoreXY

#include <gcode.h>

#define Speed 100

void homing();
commandscallback commands[1] = {{"G28",homing}};
gcode Commands(1,commands);

double X;
double Y;
double A;
double B;

void setup()
{
  Commands.begin();
}

void loop() 
{
  if(Commands.available())
  {
    double newXValue = X;
    double newYValue = Y;
    
    if(Commands.availableValue('X'))
      newXValue = Commands.GetValue('X');
    if(Commands.availableValue('Y'))
      newYValue = Commands.GetValue('Y');

    gotoLocation(newXValue,newYValue);
  }
}

void homing()
{
  // code to home machine
}

void gotoLocation(double NewX,double NewY)
{
  double YCurrent = 0.5*(A + B);
  double XCurrent = 0.5*(A - B);
  double R = sqrt((NewY-YCurrent)*(NewY-YCurrent)+(NewX-XCurrent)*(NewX-XCurrent));
  double t = R/Speed;

  double ANewPosition = NewX+NewY;
  double BNewPosition = NewX-NewY;
  double SpeedA = abs(ANewPosition - A)/t;
  double SpeedB = abs(ANewPosition - B)/t;
  
  X = NewX;
  Y = NewY;
  A = ANewPosition;
  B = BNewPosition;

  // code to run machine to location using:
  //  - ANewPosition (or A) and BNewPosition (or B)
  //  - SpeedA and SpeedB
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].