Main Program
Dependencies: mbed AQM1602 HMC6352 PID
Diff: setting/main.h
- Revision:
- 16:6900f47fa0b5
- Parent:
- 15:88f2c525caca
- Child:
- 17:61edad76efd7
--- a/setting/main.h Sat Jan 09 02:15:46 2016 +0000 +++ b/setting/main.h Mon Jan 11 17:45:56 2016 +0000 @@ -3,53 +3,49 @@ #include "def.h" +//pc(Computer) +RawSerial pc(monitor_tx, monitor_rx); +//led(main) +DigitalOut LED[4]={led1, led2, led3, led4}; +//line(bottom) +BusIn LineIn(lineInA, lineInB, lineInC); +BusOut LineOut(lineA1, lineA2, lineB1, lineB2, lineC1, lineC2); +//ballcheck(bottom) +DigitalIn BallChecker(ballcheck); +//debug_switch(debug_board) +Pswitch Sw[4] = {selectsw1, selectsw2, debugsw1, debugsw2}; +//motor(main) +Serial motor(motor_tx, motor_rx); +//spi(main) +SPI spi(SPI_mosi, SPI_miso, SPI_slck); +DigitalOut spi_ss[4]={SPI_ss_sd, SPI_ss_sonic, SPI_ss_color, SPI_ss_ir}; +//bluetooth(debug_board) +RawSerial RN42(blue_rxd, blue_txd); +DigitalOut RN42_Reset(blue_reset); +//lcd(debug_board) +AQM1602 Lcd(lcd_sda, lcd_scl); +//gyro(debug_board) +MPU6050 mpu(sens_sda, sens_scl); // sda, scl pin +InterruptIn INT0(sens_interrupt); // INT0 pin +//mouse(bottom) +adns_9800 mouse_sensor(mouse_mosi, mouse_miso, mouse_slck, mouse_ss); +//solenoid(bottom) +DigitalOut kicker(solenoid); + +//Serial for motors +int speed[4]={0}; +string StringFIN; +//PID +PID pid(P_GAIN,I_GAIN,D_GAIN, RATE); +Ticker pidupdate; +//for Serial volatile uint8_t INdata[DATA_NUM]={0}, EXdata[DATA_NUM]={0}; +//for DataSet Record data; -BusOut LED(LED1); -RawSerial pc(SERIAL_TX, SERIAL_RX); -RawSerial RN42(D8, D2); -AQM1602 Lcd(NC, NC); +// for Time Timer t; Ticker Duty[DUTY_NUM]; Timeout Stp; - -MPU6050 mpu(D14, D15); // sda, scl pin -InterruptIn INT0(D7); // INT0 pin - - -//BusIn Sw(NC, NC); -Pswitch Sw(NC); - -//Serail for motors -string StringFIN; - -//mouse -static PinName const MOSI = D11; -static PinName const MISO = D12; -static PinName const SCLK = D13; -static PinName const NCS = D10; -adns_9800 mouse_sensor(MOSI, MISO, SCLK, NCS); - - -//Lcd出力文字(6文字に揃える.) -char lcdstr[0x10][0x04][BUFSIZE]={ - {{"None "}, {0 }, {0 }, {0 }}, - {{"Start "}, {0 }, {0 }, {0 }}, - {{"Debug0"}, {"Ir0 "}, {"Ir1 "}, {"Ir2 "}}, - {{"Debug1"}, {"Ping0 "}, {"Mouse0"}, {"Gyro0 "}}, - {{"Debug2"}, {0 }, {0 }, {0 }}, - {{"Test0 "}, {0 }, {0 }, {0 }}, - {{"Test1 "}, {0 }, {0 }, {0 }}, - {{"Test2 "}, {0 }, {0 }, {0 }}, - {{"Calib0"}, {0 }, {0 }, {0 }}, - {{"Calib1"}, {0 }, {0 }, {0 }}, - {{"Calib2"}, {0 }, {0 }, {0 }}, - {{"Save "}, {0 }, {0 }, {0 }}, - {{"Store "}, {0 }, {0 }, {0 }}, - {{"Def0 "}, {0 }, {0 }, {0 }}, - {{"Att0 "}, {0 }, {0 }, {0 }}, - {{"Stop "}, {0 }, {0 }, {0 }} -}; double dutycycle[DUTY_NUM] ={//[s] 0.2 };