Coder Social home page Coder Social logo

libconsole's Introduction

libconsole

Easy to use console application for PROS projects

libconsole is a convenient console for PROS projects based off travisg's littkernel/lk console application.

Pull requests are welcome to add standard functionality to the console!

Installation

To be done, but:

prosv5 conduct apply libconsole

Note: An unreleased version of PROS kernel is required. Use a template from at least purduesigbots/pros@065b9d4 (this commit has been on develop branch)

Example

#include "main.h"
#include "console/command.h"

/**
 * This macro expands into a function prototype, e.g.
 * static int move_motor(int argc, const cmd_args *argv)
 */
static CONSOLE_COMMAND(move_motor)
{
  if (argc != 3) {
    printf("Invalid number of arguments: %d\n", argc);
    printf("move_motor 1 127");
  }

  /**
   * argv[0] is command name (move_motor)
   * argv[1] is first argument
   * argv[2] is second argument, and so on
   * First argument is motor port, second argument is desired speed
   * Note: if first or second arguments aren't integers, then "argv[x].i" is 0
   *       If you don't trust the user, then you'll need to do sscanf yourself
   *       to convert argv[x].str to whatever format
   */
  Motor(argv[1].i).move(argv[2].i);

  return 0;
}
/**
 * This macro registers the command with console
 * First parameter is function name
 * Second parameter is optional and is help text when running "help" command
 * Third parameter is optional and is command string to use. Function name is default if not provided
 */
STATIC_COMMAND_SINGLE(move_motor);

libconsole's People

Contributors

edjubuh avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

libconsole's Issues

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.