Demo Code for the Automotive Gauge Stepper Motor moving the needle to several locations starting from zero initial position

Dependencies:   Stepper_Motor_X27168 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "StepperMotor_X27168.h"
00003 
00004 StepperMotor_X27168 smotor(p25, p26, p23, p22);
00005 
00006 int main() {
00007 
00008     smotor.step_position(180);
00009     wait(0.5);
00010     
00011     smotor.step_position(100);
00012     wait(0.5);
00013     
00014     smotor.angle_position(270);
00015     wait(0.5);
00016     
00017     smotor.step_position(0);
00018     wait(0.5);
00019 }