Program using the Touch Sensor and a Servo

Dependencies:   Servo TSI mbed

Files at this revision

API Documentation at this revision

Comitter:
icarobrito
Date:
Wed Nov 12 18:01:35 2014 +0000
Commit message:
Program using the Touch Sensor and a Servo

Changed in this revision

Servo.lib Show annotated file Show diff for this revision Revisions of this file
TSI.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r b831c26b9a46 Servo.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Servo.lib	Wed Nov 12 18:01:35 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/jdenkers/code/Servo/#352133517ccc
diff -r 000000000000 -r b831c26b9a46 TSI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TSI.lib	Wed Nov 12 18:01:35 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/TSI/#1a60ef257879
diff -r 000000000000 -r b831c26b9a46 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Nov 12 18:01:35 2014 +0000
@@ -0,0 +1,27 @@
+/*Programa para acionamento de um servomotor
+O servo motor funciona de 90º a -90º
+Neste programa é feita a leitura do touch e é utilizada para a posição do servomotor
+*/
+#include "mbed.h"
+#include "Servo.h"
+#include "TSISensor.h"
+
+TSISensor touch; //declarando o objeto do touch
+Servo servo(PTE29); //declarando o objeto do servomotor e o pino
+
+
+
+  int main() {
+    float a=0;
+    servo.Enable(1000,20000);
+    while(1){
+          a=touch.readPercentage();
+          a=a*1000+1000;       //Fórmula para equiparar as escalas do servomotor e do sensor touch
+          servo.SetPosition(a);  
+          wait(1);
+      
+ 
+      
+    }
+ }
+ 
\ No newline at end of file
diff -r 000000000000 -r b831c26b9a46 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Nov 12 18:01:35 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file