![](/media/cache/profiles/ae9962652ca72b43b47d23ca1a088f74.jpg.50x50_q85.jpg)
Program using the Touch Sensor and a Servo
Revision 0:b831c26b9a46, committed 2014-11-12
- 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
--- /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
--- /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
--- /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
--- /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