Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neuberfran/6f48c39105c9adea9aa8df05f73087ff to your computer and use it in GitHub Desktop.
Save neuberfran/6f48c39105c9adea9aa8df05f73087ff to your computer and use it in GitHub Desktop.
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