servo:ADC
Dependencies: mbed Servo TextLCD
Revision 0:1c10094f5bbb, committed 2020-06-10
- Comitter:
- 20172573073
- Date:
- Wed Jun 10 18:14:10 2020 +0000
- Commit message:
- programasazo farith
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Wed Jun 10 18:14:10 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/simon/code/Servo/#36b69a7ced07
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Wed Jun 10 18:14:10 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Jun 10 18:14:10 2020 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+#include "TextLCD.h"
+#include "Servo.h"
+TextLCD lcd(D0,D1,D2,D3,D4,D5, TextLCD::LCD16x2 );
+AnalogIn ain(A0);
+Servo led(PTD5);
+//PwmOut led(PB_0);
+float p;8
+
+int main()
+{
+ led.calibrate(0.0015,180);
+
+ while(1) {
+ lcd.cls();
+ p=ain.read();
+ lcd.printf("porcen: %1.4f",p);
+ if(p<0.5) {
+ for(int i=0; i<100; i++) {
+ led = i/100.0;
+ wait(0.01);
+ }
+ } else {
+ for(int i=100; i>0; i--) {
+ led = i/100.0;
+ wait(0.01);
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jun 10 18:14:10 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file