copia12092018

Dependencies:   mbed

Committer:
francescopistone
Date:
Wed Sep 12 14:41:23 2018 +0000
Revision:
6:3263fc9d7423
Parent:
5:72bdc69d610d
Child:
7:dc3cb1a5764b
aggiunti commenti

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nerit 0:b0a79a3a9da8 1 //#Serial pc(SERIAL_TX, SERIAL_RX);
viaromassimo 5:72bdc69d610d 2 #if defined(logActive)
viaromassimo 5:72bdc69d610d 3 Serial pc(D1, D0, 115200);
viaromassimo 5:72bdc69d610d 4 #endif
nerit 0:b0a79a3a9da8 5
viaromassimo 1:59c30e854dfb 6 InterruptIn WheelSensorPin(D5); //pin at which the wheel sensor is attached
francescopistone 6:3263fc9d7423 7 //lettura rotazione ruota
viaromassimo 1:59c30e854dfb 8 InterruptIn MotorSensorPin(D4); //pin connected to motor sensor pin
francescopistone 6:3263fc9d7423 9 //lettura feedback motore
viaromassimo 1:59c30e854dfb 10 DigitalIn OnOffPin(D12); //pin connected to on/off switch
francescopistone 6:3263fc9d7423 11 //enable
nerit 0:b0a79a3a9da8 12 PwmOut MotorPwmPin(PA_1); //pin connected to motor - this must be a digital PWM pin
francescopistone 6:3263fc9d7423 13 //controllo pwm velocità motore
viaromassimo 1:59c30e854dfb 14 DigitalIn PlusPercentPin(D3); //pin connected to +XX% switch
francescopistone 6:3263fc9d7423 15 // velocità motore = k * velocità ruota : aumento il k
viaromassimo 1:59c30e854dfb 16 DigitalIn MinusPercentPin(D6); //pin connected to -XX% switch
francescopistone 6:3263fc9d7423 17 // velocità motore = k * velocità ruota : dimiuisco il k
nerit 0:b0a79a3a9da8 18
nerit 0:b0a79a3a9da8 19 DigitalOut SDmotorInB(PA_7); // sd motor half bridge direction selector
francescopistone 6:3263fc9d7423 20 //comando del ponte ad H per decidere il verso di rotazione (+VDC -VDC) VEDI VNH3SP30
nerit 0:b0a79a3a9da8 21 DigitalOut SDmotorInA(PA_2); // SD motor half bridge direction selector
francescopistone 6:3263fc9d7423 22 //comando del ponte ad H per decidere il verso di rotazione (-VDC +VDC)
nerit 0:b0a79a3a9da8 23 DigitalIn enDiag_A(PA_4); // SD motor fault condition input A
francescopistone 6:3263fc9d7423 24 // non usato
nerit 0:b0a79a3a9da8 25 DigitalIn enDiag_B(PA_3); // SD motor fault condition input A
francescopistone 6:3263fc9d7423 26 // non usato
nerit 0:b0a79a3a9da8 27 AnalogIn SDcurrent(PA_0); // SD power current feedback
francescopistone 6:3263fc9d7423 28 // non usato
nerit 0:b0a79a3a9da8 29 DigitalOut led(LED1);
nerit 0:b0a79a3a9da8 30 #if defined(canbusActive)
nerit 0:b0a79a3a9da8 31 CAN can1(D10,D2,100000); // CAN BUS channel for communication with other slave and master consolle
nerit 0:b0a79a3a9da8 32 #endif
nerit 0:b0a79a3a9da8 33 CANMessage txMsg;
nerit 0:b0a79a3a9da8 34 CANMessage rxMsg;