From 329613eb48542f24bb9014a0a617b05199726e99 Mon Sep 17 00:00:00 2001 From: siddhu8990 Date: Thu, 17 Dec 2015 14:48:36 +0530 Subject: Code generation for Arduino changed. DC motor added to Arduino. --- .../cmd_dcmotor_setup/u8cmd_dcmotor_setups.c | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c (limited to 'src/c/scilab-arduino/cmd_dcmotor_setup') diff --git a/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c b/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c new file mode 100644 index 0000000..30b4b9b --- /dev/null +++ b/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c @@ -0,0 +1,42 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Arnaud TORSET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt + * + */ + +#include "cmd_dcmotor_setup.h" + +uint8 dcm_pin_1[4], dcm_pin_2[4], dcm_mode[4]; + +uint8 u8cmd_dcmotor_setups(uint8 board_no, uint8 driver_type, uint8 motor_no,\ + uint8 pin_1, uint8 pin_2) +{ + dcm_pin_1[motor_no] = pin_1; + dcm_pin_2[motor_no] = pin_2; + dcm_mode[motor_no] = driver_type; + + //Initialise pins + pinMode(pin_1,OUTPUT); + pinMode(pin_2,OUTPUT); + + //Set output to low. + if(driver_type == 3) + { + analogWrite(pin_1,0); + analogWrite(pin_2,0); + } + else + { + digitalWrite(pin_1,LOW); + digitalWrite(pin_2,LOW); + } + + return 0; +} + -- cgit