Microrobots enhance contact with pollutants through their movement and flow-induced mixing, substantially improving wastewater treatment efficiency beyond traditional diffusion-limited methods. g-C3N4 is an affordable and environmentally friendly photocatalyst that has been extensively researched in various fields such as biomedicine and environmental remediation. However, compared to other photocatalytic materials like TiO2 and ZnO, which are widely used in the fabrication of micro- and nanorobots, research on g-C3N4 for these applications is still in its early stages. This work presents microrobots entirely based on g-C3N4 microtubes, which can initiate autonomous movement when exposed to ultraviolet and visible light. We observed distinct motion behaviors of the microrobots under light irradiation of different wavelengths. Specifically, under ultraviolet light, the microrobots exhibit negative photogravitaxis, while under visible light, they demonstrate a combination of 3-dimensional motion and 2-dimensional motion. Therefore, the wavelength of the light can be used for programming the motion style of the microrobots and subsequently their application. We show that the microrobots can effectively degrade the antibiotic tetracycline, displaying their potential for antibiotic removal. This exploration of autonomous motion behaviors under different wavelength conditions helps to expand research on g-C3N4-based microrobots and their potential for environmental remediation.