CupCarbon Tutorials
CupCarbon Tutorials
Download CupCarbon
Visit the following website and donwload CupCarbon:
www.cupcarbon.com
You unzip the file cupcarbon.zip
You will get the following files:
If CupCarbon does not start then you may check the version of java installed in your system, you can use the following command:
java -version
https://www.oracle.com/java/technologies/downloads/#java8-mac
Go to the section: Java SE Development Kit 8u391
Choose your platform and download the installer.
Once Java installed run CupCarbon using the java command:
If it does not work, then run CupCarbon using the complete path of Java. For example, for mac OS, go to the directory where the cupcarbon.jar is situated and write
the following command:
cupcarbon.com/CupCarbon-Tutorials.html 1/4
10/25/23, 12:30 PM CupCarbon Tutorials
Step 2
Install Python
You can install any version of Python you want.
To verify if Python is installed you can use the following command:
python -V
Python is completely independent from CupCarbon, once installed, you have to use the system command used to execute Python programs.
Basically this command can by python or python3
python
It can be a complete path where the command is situated in your system. You can add this commande (or path) in the Executor Path Configuration window as shown
by the following figures:
cupcarbon.com/CupCarbon-Tutorials.html 2/4
10/25/23, 12:30 PM CupCarbon Tutorials
Step 3
Visualisation
To interace with CupCarbon from your Python codes, you can send commands to CupCarbon and you can get commands from CupCarbon as well.
To send commands from your code Python to CupCarbon, use the command print of Python normally. The message of the print will be considered as a CupCarbon
command. You need to flush each command to send it directly, otherwise, all the commands will be sent once at the end of the program. In this case you have to use
the command:
sys.stdout.flush() after each print command
To use this command you need to import the library sys, as follows:
import sys
In a nutshell:
Any Python program communicating with CupCarbon has to import the library sys, to send the CupCarbon comands using the command print and to flush the
message (send it to CupCarbon) using the command flush:
The different commands that you can send to CupCarbon are given as follows:
1. print
To print any message on the executing device, use the command print as follows:
2. mark/unmark
To mark or unmark the executing device, use the commande mark or unmark as follows:
print("mark", flush=True)
print("unmark", flush=True)
3. move
To move the executing device to a given GPS location, use the move command as follows:
4. To get any information about the executing device sugh as, its id, its name and its location, use the following commands:
print("getid", flush=True)
id = input()
print("getname", flush=True)
name = input()
print("getxy", flush=True)
location = input()
print("getx", flush=True)
x = input()
print("gety", flush=True)
y = input()
Step 4
It is possible to use MQTT in different real devices (Android device, iOS, ESP32, Raspberry, ...) to communicate with CupCarbon devices.
You can install Mosquitto to use MQTT from the terminal of your system.
https://mosquitto.org/download/
Two samples (Pbulisher and Subscriber) are given in CupCarbon that can be used directly. Don't forget to set the value of the broker and the topics if you are using
these codes.
TUTORIALS
Tutorial 1: Hello World!
source code
Tutorial 4: Blink
source code
Tutorial 5: Move
source code
cupcarbon.com/CupCarbon-Tutorials.html 4/4