Skip to content

Beans and Beanscript

Xyno edited this page Mar 18, 2025 · 1 revision

To understand what Beanscript is, you'll first need to understand what I mean by a Bean. When I refer to a "Bean", I am referring to a script with the name bean.py in your CIRCUITPY drive. This script is the script that injects your payload (or "coffee") into your device. You write this script with the Beanscript Library.

Now, how do we actually write a Bean you ask? It's quite simple:

  1. Import the beanscript library
import beanscript
  1. Define the main function (this is what is executed when you click the drip button in the web interface)
def main():
  1. Use the Beanscript library to inject some coffee
beanscript.write("Hello, Beandrip!")
beanscript.move(50, 50)

This code will first emulate a keyboard and type "Hello, Beandrip!", and then emulate a mouse and move 50px in the X and Y axes.

Full code:

import beanscript

def main():
    beanscript.write("Hello, Beandrip!")
    beanscript.move(50, 50)

Clone this wiki locally