summaryrefslogtreecommitdiff
path: root/2.3-1/src/c/scilab-arduino/cmd_servo_move
diff options
context:
space:
mode:
authorimushir2016-02-09 16:38:27 +0530
committerimushir2016-02-09 16:38:27 +0530
commita6efab1a42eda8c1e3902c2f2d030a9cb9cfd25e (patch)
tree70d366ae6a84d201f23895071a8064068e77011f /2.3-1/src/c/scilab-arduino/cmd_servo_move
parent7bc57b2061931e5b5843ac6616591b7cff9e9476 (diff)
downloadScilab2C-a6efab1a42eda8c1e3902c2f2d030a9cb9cfd25e.tar.gz
Scilab2C-a6efab1a42eda8c1e3902c2f2d030a9cb9cfd25e.tar.bz2
Scilab2C-a6efab1a42eda8c1e3902c2f2d030a9cb9cfd25e.zip
Support for Servo motor for Arduino. Support for'diag' in c
Diffstat (limited to '2.3-1/src/c/scilab-arduino/cmd_servo_move')
-rw-r--r--2.3-1/src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_move.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/2.3-1/src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_move.cpp b/2.3-1/src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_move.cpp
new file mode 100644
index 00000000..e8874766
--- /dev/null
+++ b/2.3-1/src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_move.cpp
@@ -0,0 +1,27 @@
+/*
+ Scilab2C FOSSEE IIT BOMBAY
+ */
+
+#include "cmd_servo_move.h"
+#include "Arduino.h"
+#include<Servo.h>
+Servo servo1,servo2;
+uint8 u8cmd_servo_move(uint8 h,uint8 servo_no,uint8 val)
+{
+ // h -> Board no. reserve for future use
+ // servo_no -> pin no.(9 and 10).
+ //val -> 0 to 180 angle of rotation
+ if (val>=0 && val<=180)
+ {
+ if (servo_no==1)
+ {
+ servo1.write(val);
+ }
+ else if (servo_no==2)
+ {
+ servo2.write(val);
+ }
+ }
+ return 0;
+}
+