If you are asking a question, please follow this template:
- to move stepper motor forward and backward
#include <stdio.h>
#include “mgos_gpio.h”
#define dirpin 4
#define steppin 3
enum mgos_app_init_result mgos_app_init(void) {
mgos_gpio_set_mode(dirpin, MGOS_GPIO_MODE_OUTPUT);
mgos_gpio_write (dirpin, 1);
for(int x = 0; x < 200; x++) {
mgos_gpio_set_mode(steppin, MGOS_GPIO_MODE_OUTPUT);
mgos_gpio_write (steppin, 1);
mgos_gpio_write (steppin, 0);
}
mgos_gpio_set_mode(dirpin, MGOS_GPIO_MODE_OUTPUT);
mgos_gpio_write (dirpin, 0);
for(int x = 0; x < 400; x++) {
mgos_gpio_set_mode(steppin, MGOS_GPIO_MODE_OUTPUT);
mgos_gpio_write (steppin, 1);
mgos_gpio_write (steppin, 0);
}
return MGOS_APP_INIT_SUCCESS;
}
3. i cant mos build this code, it alwasy failed. there was no error in my code but it cant build.
- whats wrong with my code, please help me. i am still new with mongoose os