Example code for interacting with the iMotions desktop API.
These examples will give you some code to learn from and get started with. They do not cover everything in the Programmer's Guide and are not ready-to-use implementations of study designs. It should be pretty easy to get started with them, but do note that they require some amount of programming knowledge to use.
See iMotions API Overview and iMotions API Setup and Programmer's Guide on the Help Center for more details. (Please note that a paid iMotions license is required to access the Help Center.)
Double-check that iMotions is running, that the API you are using is enabled in Global Settings -> API, that the port is correct, and that you have enabled TCP.
Double-check that you are sending the right fields for the command, that the fields are separated with a semicolon, that the command ends with \r\n (i.e. carriage return line feed or 0x13 0x10), and that it is encoded as UTF-8.
You can also check C:\ProgramData\iMotions\Lab_XG\Log\imotions.log for error logging from iMotions.
Double-check that your data source is actually outputting data at the expected sampling rate without forwarding the data to iMotions. Also check how long you are waiting between sending data, if that is e.g. exactly 1000ms, then your sampling rate will be slightly below 1hz since the rest of your program takes some additional time.
If you contact iMotions support we can help you with:
- Advice on how the API can be useful for your research goals and study design
- Troubleshooting specific problems with the API
Unfortunately we do not have the resources to help you with:
- Learning programming
- Setting up your computer for software development
- Debugging your programs
- Untangling AI-generated code that does not work
If you need this type of help we recommend finding a colleague or graduate student with some programming knowledge to assist you instead.