![](/media/cache/group/mehmet_akif_arvas.jpg.50x50_q85.jpg)
rtos ile keypad, servo, step ve lcd ekran kontrolu
Dependencies: beep TextLCD keypad
Revision 0:2680050cef72, committed 2019-05-06
- Comitter:
- marvas
- Date:
- Mon May 06 10:32:55 2019 +0000
- Commit message:
- rtos ile keypad, servo, step ve lcd ekran kontrolu
Changed in this revision
diff -r 000000000000 -r 2680050cef72 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Mon May 06 10:32:55 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
diff -r 000000000000 -r 2680050cef72 beep.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/beep.lib Mon May 06 10:32:55 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/dreschpe/code/beep/#d8e14429a95f
diff -r 000000000000 -r 2680050cef72 keypad.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/keypad.lib Mon May 06 10:32:55 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Marvas/code/keypad/#7da3ab010a87
diff -r 000000000000 -r 2680050cef72 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon May 06 10:32:55 2019 +0000 @@ -0,0 +1,111 @@ +#include "mbed.h" + +#include "TextLCD.h" +#include <iostream>//cin ve cout +#include "beep.h" +#include "Keypad.h" +char x; +TextLCD lcd(D7, D6, D5, D4, D3, D2); // rs, e, d4-d7 +// Define your own keypad values +char key_table[] = { '1', '2', '3', 'A', + '4', '5', '6', 'B', + '7', '8', '9', 'C', + '*', '0', '#', 'D' + }; + + +Beep buzzer(A0); + +BusOut step(D8,D9,D10,D11); +DigitalOut servo(D12); +Serial pc(USBTX,USBRX); +DigitalOut led(LED1); +void servometot(); +void stepmetot(); +void lcdmetot(); +Thread servomotor,stepmotor,lcdekran; + + +int main() +{ + Keypad key(PC_4, PB_13, PB_14, PB_15, PB_1, PB_2, PB_12, PA_11); + //satır 4321 sutun 4321 + uint32_t key_num; + servomotor.start(servometot); + stepmotor.start(stepmetot); + lcdekran.start(lcdmetot); + while(true) { + while ((key_num = key.read()) != 0) { + lcd.locate(0,1); + lcd.printf("%c", *(key_table + key_num-1)); + printf("%c\n", *(key_table + key_num-1)); + } + wait(0.1); + } +} +void servometot() +{ + while(1) { + for(uint8_t x=0; x<5; x++) { + servo=1; + wait_ms(1.5); + servo=0; + wait_ms(18.5); + } + wait(1); + for(uint8_t x=0; x<5; x++) { + servo=1; + wait_ms(1); + servo=0; + wait_ms(19); + } + wait(1); + for(uint8_t x=0; x<10; x++) { + servo=1; + wait_ms(2); + servo=0; + wait_ms(18); + } + wait(1); + } + +} + + +void stepmetot() +{ + step=0x0; + while(1) { + + step=0x8; + wait_ms(1); + step=0x4; + wait_ms(1); + step=0x2; + wait_ms(1); + step=0x1; + wait_ms(1); + } +} +void lcdmetot() +{ + // bool y=0; + while(1) { + + for(uint8_t x=0; x<11; x++) { + + lcd.locate(x-1,0); + lcd.printf(" "); + lcd.locate(x,0); + lcd.printf("mehmet"); + wait_ms(200); + } + for(uint8_t x=0; x<16; x++) { + + lcd.locate(x,0); + lcd.printf(" "); + } + // y=!y; + + } +} \ No newline at end of file
diff -r 000000000000 -r 2680050cef72 mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Mon May 06 10:32:55 2019 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#c9e63f14085f5751ff5ead79a7c0382d50a813a2