Created
August 15, 2022 21:42
-
-
Save neuberfran/6f48c39105c9adea9aa8df05f73087ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ARDUINO_MAIN.CPP | |
============================ | |
#include <Arduino.h> | |
#include <SmartDrive.h> | |
SmartDrive smd = SmartDrive(SmartDrive_DefaultAddress); | |
void setup(void) | |
{ | |
Serial.begin(); | |
} | |
void loop(void) | |
{ | |
Serial.print("Motor powered: " + smd.IsMotorPowered(SmartDrive_Motor_ID_1)); | |
// smd.Run_Seconds(SmartDrive_Motor_ID_1, SmartDrive_Dir_Reverse, 90, 11, true, SmartDrive_Action_Brake); | |
smd.Run_Unlimited(SmartDrive_Motor_ID_1, SmartDrive_Dir_Reverse, 90); | |
smd.Run_Unlimited(SmartDrive_Motor_ID_2, SmartDrive_Dir_Forward, 90); | |
// delay(5000); | |
} | |
MAINC.C | |
============== | |
#include <rtthread.h> | |
#include <rtdevice.h> | |
#include <board.h> | |
/* defined the LED1 pin: PG6 */ | |
#define LED4_PIN GET_PIN(K, 3) | |
int main(void) | |
{ | |
/* set LED1 pin mode to output */ | |
rt_pin_mode(LED4_PIN, PIN_MODE_OUTPUT); | |
while (1) | |
{ | |
rt_pin_write(LED4_PIN, PIN_HIGH); | |
rt_thread_mdelay(500); | |
rt_pin_write(LED4_PIN, PIN_LOW); | |
rt_thread_mdelay(500); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment