A guide to robotics

Documentation

ComfyScript

A scripting language to make controlling robots as simple as spoken English

Below is how you can control common robotics components using ComfyScript. No more 100+ lines of Python codes.




LED

$ comfy led 15 off

LED

LED (light emitting diode) lights up when there's power. Comes in variety of colors

The ultimate starter component for all robotics enthuiastsπŸ‘Œ


This command is used to turn on or off an led.

$ comfy led {pin} {state}

{pin} stands for the GPIO pin attached to the + side of the LED.

{state} represents the on/off state of the led. {state} has 2 values of 1 & 0 for On & Off, respectively.

For example, his turns an LED attached to pin 11 on

$ comfy led 11 1

For example, this command turns an LED attached to pin 12 off

$ comfy led 12 0

LED

$ comfy led 15 off

DC Motor

DC motors create motions (clockwise or counter-clockwise) when powered. This is meant to be used with an L298N controller. DC Motor is used to generate fast & continuous motion, useful for RC car wheels & anything that spins fast.

My favorite component πŸ˜‹


This command is used to control a single DC motor attached to a L298N

$ comfy dc {pin+} {pin-} {state+} {state-}

{pin+} & {pin-} represents the GPIO pins connected to the + & - sides of the DC motor.

{state+} & {state-} are used to control the direction in which the motor rotates. These both have 2 values 0 & 1, representing off & on.

For example, this command will turn a DC motor (attached to pins 23 & 24) clockwise

$ comfy dc 23 24 1 0

For example, this command will turn a DC motor (attached to pins 23 & 24) off

$ comfy dc 23 24 0 0

For example, this command will turn a DC motor (attached to pins 23 & 24) counter-clockwise

$ comfy dc 23 24 0 1

LED

$ comfy led 15 off

Stepper Motor

Stepper motors are motors that spin to very accurate angles. This is useful for applications requiring accurate movements such as conveyor belts, turning system for RC cars, etc.

Your 3D printer has at least 3 of these πŸοΈπŸ’¨


This command is used to control the direction of the stepper motor movement.

$ comfy stepper {pin1} {pin2} {pin3} {pin4} {direction}

{pin1} to {pin4} are the GPIO pins used to control the stepper motor.

{direction} represents rotational direction. {direction} has 3 values: -1, 0, 1 for counter-clockwise, stop, clockwise.

For example, this command is used to control the stepper motor attached to pins 23, 24, 22, 27 to move clockwise

$ comfy stepper 23 24 22 27 1

LED

$ comfy led 15 off

Temperature & humidity sensor

DHT sensors provide reading of temperature & humidity. Currently supported sensors include DHT 11, 22 & 2302 (which is like... all of 'em).

Side note: this won't break no matter how much you break 'em πŸ”₯


This command returns temperature reading.

$ comfy dht_temp {sensor type} {pin}

{sensor type} stands for the DHT sensor type. This has 3 values 11, 22 & 2302.

{pin} stands for the GPIO pin which the DHT sensor is connected to.

For example, this command returns temperature reading from sensor type DHT11 & attached to pin 13.

$ comfy dht_temp 11 13

This command returns humidity reading.

$ comfy dht_humid {sensor type} {pin}

{sensor type} stands for the DHT sensor type. This has 3 values 11, 22 & 2302.

{pin} stands for the GPIO pin which the DHT sensor is connected to.

For example, this command returns temperature reading from sensor type DHT22 & attached to pin 15.

$ comfy dht_humid 22 15

LED

$ comfy led 15 off

Distance sensor

The HC-SR04 sensor is widely used to measure distance. Small, cheap & versatile. All things should be like this, don't you agree?


This works using sonic btw 😎


This command returns the distance reading.

$ comfy distance {trigger} {echo} {state}

{trigger} & {echo} stands for the GPIO pins connected to the sensor.

{state} has 2 values 0 & 1, used to turn the sensor off & on accordingly

For example, this command returns distance sensor reading from a sensor connected to pins 22 & 23.

$ comfy distance 22 23 1

This command turns the sensor off (to save energy & the planet in the process... probably).

$ comfy distance 22 23 0

LED

$ comfy led 15 off

Gemini (Google AI)

Yep, you're reading it right! ComfyScript has Gemini AI chat built-in. We built this with convenience & simplicity in mind.

AI is everywhere nowaday, might as well take a piece πŸ’Έ


This command is used to setup your API key. Meant to run once per Raspberry Pi.

$ comfy gemini_setup {api}

{api} stands for the Google Gemini API.

Don't worry, Google Gemini has a generous free tier.

This command returns a response from Gemini.

$ comfy gemini_run {prompt}

{prompt} stands for your prompt/question to the AI!

Don't ask anything explicitly sexual. I mean it!








Want to use ComfyScript for your next project?


Website preview

Launch ahead!

The app looks much better than in the picture, btw! ✌

/download

ComfyScript open source, btw


Website preview

Github

Built with love by Thomas the Maker πŸ’˜

https://github.com/ThomasVuNguyen/comfyScript