ManualController

Dependents:   ConfigurationVerifier

Committer:
lmarketin
Date:
Fri May 07 13:51:00 2021 +0000
Revision:
0:abed7d1e329c
ManuallController

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lmarketin 0:abed7d1e329c 1 #include "manualController.h"
lmarketin 0:abed7d1e329c 2
lmarketin 0:abed7d1e329c 3 ManualController::ManualController(PinName pinDistance, Serial* pc, SRF05* ranger, PwmOut* rangerServo, PwmOut* fan,PwmOut* fanServo, DigitalOut* greenLed, DigitalOut* redLed):
lmarketin 0:abed7d1e329c 4 m_interruptDistance(pinDistance, PullDown), m_pc(pc), m_ranger(ranger), m_rangerServo(rangerServo), m_fan(fan), m_fanServo(fanServo),
lmarketin 0:abed7d1e329c 5 m_greenLed(greenLed), m_redLed(redLed)
lmarketin 0:abed7d1e329c 6 {
lmarketin 0:abed7d1e329c 7 m_interruptDistance.rise(this, &ManualController::hwInterruptReadDistance);
lmarketin 0:abed7d1e329c 8 }
lmarketin 0:abed7d1e329c 9
lmarketin 0:abed7d1e329c 10 void ManualController::executeManualControll()
lmarketin 0:abed7d1e329c 11 {
lmarketin 0:abed7d1e329c 12 AnalogIn servoRangerAIn(A1);
lmarketin 0:abed7d1e329c 13 AnalogIn servoFanAIn(A2);
lmarketin 0:abed7d1e329c 14 AnalogIn fanAIn(A3);
lmarketin 0:abed7d1e329c 15
lmarketin 0:abed7d1e329c 16 while(1) {
lmarketin 0:abed7d1e329c 17 m_rangerServo->pulsewidth_us(500+(2000*servoRangerAIn));
lmarketin 0:abed7d1e329c 18 wait(0.15);
lmarketin 0:abed7d1e329c 19 m_fanServo->pulsewidth_us(500+(2000*servoFanAIn));
lmarketin 0:abed7d1e329c 20 wait(0.15);
lmarketin 0:abed7d1e329c 21 m_fan->pulsewidth_us(20000*fanAIn);
lmarketin 0:abed7d1e329c 22 wait(0.15);
lmarketin 0:abed7d1e329c 23 }
lmarketin 0:abed7d1e329c 24 }
lmarketin 0:abed7d1e329c 25
lmarketin 0:abed7d1e329c 26 void ManualController::hwInterruptReadDistance() {
lmarketin 0:abed7d1e329c 27 m_pc->printf("Distance: %f\r", m_ranger->read());
lmarketin 0:abed7d1e329c 28 }