diff options
author | siddhu8990 | 2015-12-17 14:48:36 +0530 |
---|---|---|
committer | siddhu8990 | 2015-12-17 14:48:36 +0530 |
commit | 02f2862023bb34146f6a0a96c2795bebe97e7c47 (patch) | |
tree | 9d2075243dcba13e417edb0929846f49b03aeac3 /2.3-1/src/c/scilab-arduino/cmd_dcmotor_setup | |
parent | eac39cdc77ad5fdaf7b245cbce5c92f105ac75bf (diff) | |
download | Scilab2C-02f2862023bb34146f6a0a96c2795bebe97e7c47.tar.gz Scilab2C-02f2862023bb34146f6a0a96c2795bebe97e7c47.tar.bz2 Scilab2C-02f2862023bb34146f6a0a96c2795bebe97e7c47.zip |
Code generation for Arduino changed. DC motor added to Arduino
Diffstat (limited to '2.3-1/src/c/scilab-arduino/cmd_dcmotor_setup')
-rw-r--r-- | 2.3-1/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/2.3-1/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c b/2.3-1/src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c new file mode 100644 index 00000000..30b4b9b3 --- /dev/null +++ b/2.3-1/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; +} + |