Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: ikarashiMDC.h
- Revision:
- 2:75153205d6e8
- Parent:
- 1:5e8014a1adbd
- Child:
- 3:615ccca78f67
diff -r 5e8014a1adbd -r 75153205d6e8 ikarashiMDC.h
--- a/ikarashiMDC.h Thu Aug 10 07:17:14 2017 +0000
+++ b/ikarashiMDC.h Tue Aug 22 01:44:17 2017 +0000
@@ -3,22 +3,62 @@
#include "mbed.h"
-
+#define LAP 0
+#define SM 1
+/** Ikarashi MDC class
+* MDC libraly
+*Example :
+*@code
+*#include "mbed.h"
+*#include "ikarashiMDC.h"
+*Serial serial(PC_10,PC_11);
+*DigitalOut serialcontrol(D2);
+*
+*ikarashiMDC ikarashi[]{
+* ikarashiMDC(&serialcontrol,2,2,SM,&serial),
+* ikarashiMDC(&serialcontrol,2,3,LAP,&serial),
+*};
+*PwmOut pwm(LED1);
+*
+*int main() {
+* serial.baud(115200);
+* float i = -1;
+* while(1) {
+* ikarashi[0].setSpeed(i);
+* ikarashi[1].setSpeed(i);
+* i += 0.01;
+S* pwm = fabs(i);
+* wait_ms(20);
+* if(i >= 1) i = -1;
+* }
+*}
+*@endcode
+**/
class ikarashiMDC
-{
-
+{
public:
- ikarashiMDC();
- int setMotorSpeed(double speed);
- int setMotorinfo(uint8_t _addr,uint8_t _motorNum,Serial* _serial);
- void stop();
- int checkcomm();
+ /** Create ikarashiMDC inctance
+ * @param address of cs pin for rs485
+ * @param addr for MDC
+ * @param ch for motor
+ * @param mdc mode (LAP or SM)
+ * @param address of serial object
+ **/
+ ikarashiMDC(DigitalOut* serialcontrol,uint8_t taddr,uint8_t tmotorNum,bool tmode,Serial *tserial);
+
+ /** drive motor
+ * @param speed of motor -1 to 1
+ **/
+ int setSpeed(const double& speed);
+
protected:
uint8_t addr;
uint8_t motorNum;
+ bool mode;
Serial* serial;
- DigitalOut* serialControl;
+ DigitalOut *serialControl;
};
+void estop(Serial *serial);
#endif
\ No newline at end of file