Leitura de um joystick e envio de dados para o PC

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Charrua
Date:
Tue May 13 08:45:35 2014 +0000
Commit message:
TEste

Changed in this revision

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 946b37bb430b main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue May 13 08:45:35 2014 +0000
@@ -0,0 +1,22 @@
+#include "mbed.h"
+
+
+AnalogIn in1(PTB0);
+AnalogIn in2(PTB1);
+DigitalIn dig(PTC7);
+ 
+Serial pc(USBTX, USBRX);
+
+int main(void) {
+
+    
+    while(true) {
+        float a=in1.read();
+        float b=in2.read();
+        int c=dig.read();
+        pc.printf("Analog 1=%f, Analog 2=%f, Botao=%i\r\n",a,b,c);
+        wait(0.5);
+        }
+    
+    
+}
\ No newline at end of file
diff -r 000000000000 -r 946b37bb430b mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue May 13 08:45:35 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file