A proper and complete formation in technology (science, communications, programming, robotics, Computational Thinking, etc.) must be imparted at all educational levels for a lifelong education. However, students may lose motivation or interest due to the complexity and abstraction of some of the concepts imparted. In line with this, the work at hand looks to improve the interest and commitment of students by presenting the programming concepts and contents in a practical way. The teaching–learning process is based on the development of projects about robotics, which are adapted for courses and groups of different educational levels. The Design Thinking methodology is used to impart the content. This methodology allows the students to experiment, design and test different solutions for a given problem, increasing their motivation and interest, promoting creativity, and making the students conscious of their learning process. Two different projects are considered, a simulated one based on a sensor network to localise and track a robot in a closed area for vocational education students, and an experimental one about constructing a robot with several capabilities using Lego Mindstorms for compulsory secondary education students. The results obtained over three different groups of students are analysed and compared, and show that the methodology and projects selected can be adopted and adapted for different educational levels, increasing the proficiency of the students, their development, motivation and self-learning despite the difficulty and complexity of some concepts related to computer science.