KRAI ITB GARUDAGO / Mbed 2 deprecated krai_roda2019

Dependencies:   mbed pid_dagoz

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers robotpin.h Source File

robotpin.h

00001 /*Garudago ITB 2019 Attributes*/
00002 
00003 #ifndef ROBOTPIN_H
00004 #define ROBOTPIN_H
00005 
00006 #include "mbed.h"
00007 #include "encoderKRAI.h"
00008 #include "CMPS12_KRAI.h"
00009 #include "Motor.h"
00010 #include "encoderHAL.h"
00011 #include <garudago_hardware_interface/JoystickPS3.h>
00012 
00013 
00014 //Serial pin for UART Arduino
00015 #define PIN_TX              PA_0
00016 #define PIN_RX              PA_1
00017 
00018 //Serial Initiate
00019 // Serial pc(USBTX, USBRX, 115200);
00020 joysticknucleo stick(PIN_TX, PIN_RX);
00021 
00022 //Compass
00023 CMPS12_KRAI compass_sensor(PC_9,PA_8, 0xC0);
00024 
00025 //Internal Encoder From Motor using interrupt
00026 encoderKRAI enc_right_top(PC_12, PC_11, 537.6, encoderKRAI::X4_ENCODING);
00027 encoderKRAI enc_left_top(PC_3,  PC_2,  537.6, encoderKRAI::X4_ENCODING);
00028 encoderKRAI enc_left_back(PC_15, PC_14, 537.6, encoderKRAI::X4_ENCODING);
00029 encoderKRAI enc_right_back(PC_13, PC_10, 537.6, encoderKRAI::X4_ENCODING);
00030 encoderKRAI enc_shagai(PC_6, PC_7, 538, encoderKRAI::X4_ENCODING);
00031 
00032 //input capture encoder
00033 // encoderHAL enc2(TIM4);
00034 // encoderHAL enc3(TIM2);
00035 // encoderHAL enc1(TIM3);
00036 
00037 Motor motor_right_top(PA_7,PA_5,  PA_6);
00038 Motor motor_left_top(PB_0,PC_1, PC_0);
00039 Motor motor_left_back(PB_1,PB_14, PB_15);
00040 Motor motor_right_back(PA_11,PA_12,PB_12);
00041 Motor motor_shagai(PA_15, PA_13, PA_14 );
00042 
00043 //pneu[0]   opto 7   = pneu buat ambil shagai           1->Pengambil tertutup
00044 //pneu[1]   opto 8   = pneu untuk extention             1->Ekstension memanjang
00045 //pneu[2]   opto 9   = pneu untuk pelontar              1->Pelontar tidak memanjang
00046 //pneu[3]   opto 2   = pneu untuk pencapit gerege       1->Pencapit tertutup
00047 //pneu[4]   opto 5   = pneu untuk menaikkan gerege      1->Posisi naik
00048 DigitalOut pneu[5] = {(PC_8),(PA_9),(PC_5),(PB_3),(PB_10)};
00049 
00050 #endif