Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Motor PS_PAD TextLCD mbed-os
Fork of cobaLCDJoyMotor_Thread by
Revision 3:a03ce2084ceb, committed 2017-12-09
- Comitter:
- rizqicahyo
- Date:
- Sat Dec 09 10:20:20 2017 +0000
- Parent:
- 2:907766ac29a2
- Child:
- 4:cd5de3b14797
- Commit message:
- tes library LCD dan joystick
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Motordriver.lib Sat Dec 09 10:20:20 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/osmeest/code/Motordriver/#83245b45ea70
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PS_PAD.lib Sat Dec 09 10:20:20 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/okini3939/code/PS_PAD/#840370e1dcce
--- a/main.cpp Sat Dec 09 09:52:26 2017 +0000
+++ b/main.cpp Sat Dec 09 10:20:20 2017 +0000
@@ -1,33 +1,50 @@
-/*********************************************************************/
-/** **/
-/** PROGRAM TAMPIL LCD **/
-/** **/
-/** 24 November, Selasa, 2015 **/
-/** **/
-/** Dibuat oleh : **/
-/** Rizqi Cahyo Yuwono **/
-/** 13214090 **/
-/** **/
-/*********************************************************************/
#include "mbed.h"
#include "TextLCD.h"
+#include "PS_PAD.h"
+#include "motordriver.h"
-TextLCD lcd(PB_7, PA_15, PA_14, PB_8, PB_1, PA_13, TextLCD::LCD20x4); //rs,e,d4-d7,
+#include <string>
+using namespace std;
+
+
+TextLCD lcd(PB_7, PA_15, PA_14, PB_8, PB_1, PA_13, TextLCD::LCD20x4); //rs,e,d4-d7
+
+PS_PAD ps2(PB_15,PB_14,PB_13, PC_4); //(mosi, miso, sck, ss)
+
+/* motor
+ Motor motor3(PA_8, PB_0, PC_15, 1); //motor1
+ Motor motor1(PA_11, PA_6, PA_5, 1); //motor2
+ Motor motor4(PA_9, PC_2, PC_3, 1); //motor_slider
+ Motor motor2(PA_10, PB_5, PB_4, 1); //motor_griper
+*/
+
Serial pc(USBTX,USBRX);
int main()
{
pc.baud(115200);
- //pc.printf("Pembacaan ADC Sensor : \n");
+ ps2.init();
+
+ string a;
while (1)
{
-
- lcd.locate(0,0);
- lcd.printf("rizqi cahyo Yuwono");
- lcd.locate(0,1);
- lcd.printf("12314090");
+ // baca input
+ ps2.poll();
+
+ if(ps2.read(PS_PAD::PAD_X)==1) a = "silang";
+ else if(ps2.read(PS_PAD::PAD_CIRCLE)==1) a = "lingkaran";
+ else if(ps2.read(PS_PAD::PAD_TRIANGLE)==1) a = "segitiga";
+ else if(ps2.read(PS_PAD::PAD_SQUARE)==1) a = "kotak";
+ else a = "NULL";
+
+
+ //tampilkan LCD
+ lcd.locate(0,0);
+ lcd.printf("input joystik :");
+ lcd.locate(0,1);
+ lcd.printf("%s",a);
wait_ms(10);
lcd.cls();
