summaryrefslogtreecommitdiff
path: root/src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attach.cpp
diff options
context:
space:
mode:
authorimushir2016-02-09 16:38:27 +0530
committerimushir2016-02-09 16:38:27 +0530
commitee5bf4d90f78673d1e4d5a9dd304ee53c503c085 (patch)
tree696221a8f8a3dffeb50d12ea287dfbdfab919fc6 /src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attach.cpp
parent8ee41aca4183a0239b9cb220de3f159b1f0910fb (diff)
downloadscilab2c-ee5bf4d90f78673d1e4d5a9dd304ee53c503c085.tar.gz
scilab2c-ee5bf4d90f78673d1e4d5a9dd304ee53c503c085.tar.bz2
scilab2c-ee5bf4d90f78673d1e4d5a9dd304ee53c503c085.zip
Support for Servo motor for Arduino. Support for'diag' in c
Diffstat (limited to 'src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attach.cpp')
-rw-r--r--src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attach.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attach.cpp b/src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attach.cpp
new file mode 100644
index 00000000..a89363ba
--- /dev/null
+++ b/src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attach.cpp
@@ -0,0 +1,26 @@
+/*
+ Scilab2C FOSSEE IIT BOMBAY
+ */
+
+#include "cmd_servo_attach.h"
+#include "Arduino.h"
+#include<Servo.h>
+Servo servo1,servo2;
+uint8 u8cmd_servo_attach(uint8 h,uint8 servo_no)
+{
+ // h -> Board no. reserve for future use
+ // servo_no -> pin no.(9 and 10).
+ if(servo_no == 1)
+ {
+ servo1.attach(9);
+ servo1.write(0);
+ }
+ else
+ {
+ servo2.attach(10);
+ servo2.write(0);
+ }
+
+ return 0;
+}
+