DEV Community

砂田沙耶
砂田沙耶

Posted on

Testing LEGO SPIKE Prime with C: Line Follower Speed & Stability

I tried controlling the LEGO SPIKE Prime using C language to evaluate its usability, processing speed, and potential for robot competitions. To test its performance, I implemented a Line Follower algorithm.

Image description

**

Two Key Experiments

**
1.Comparing the Line Follower performance using SPIKE App’s Word Blocks vs. C language
2.Maximizing Line Follower speed using C language with PD control
**

1. Comparing SPIKE App Word Blocks vs. C Language

**
I created a Line Follower program using both SPIKE App (Word Blocks) and C language, keeping the control logic the same.

  • The C language version provided more stable driving performance compared to the SPIKE App.
  • Watch the comparison video here: [Video Link]
  • Below is the source code for both versions: Image description Image description

**

2. Improving Line Follower Speed with C

**
I tested how much I could increase the Line Follower speed using C language.

  • Watch the actual test video: [Video Link]
  • Without extensive tuning, I achieved speeds of approximately 820 deg/s.
  • Adding a second color sensor or optimizing the robot assembly could further improve stability.

**

Development Environment & Resources

**
For C programming, I used this development environment: [spike-rt]
If you want to try it, there is a beginner-friendly tutorial available, including a trial (as of February 2025).

🔹 Download the program used in this article: [Download Link]

Future Tests & Robot Competition Applications
I plan to conduct further tests on the usefulness of C language for robot competitions and will share my findings in upcoming articles. Stay tuned!

Top comments (0)