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: 2017NHKpin_config FEP ikarashiMDC
Fork of NHK2017_octopus2 by
Diff: bot/slider/slider.cpp
- Revision:
- 9:39be1525dfe0
- Child:
- 15:9aa11febe517
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bot/slider/slider.cpp Thu Sep 07 17:37:41 2017 +0900
@@ -0,0 +1,28 @@
+#include "slider.h"
+
+Slider::Slider(DigitalOut* RS485Controller, Serial* RS485) :
+ slideMotor(RS485Controller, 1, 0, SM, RS485),
+ encoder(Sensor4pin1a, Sensor4pin1b, NC, PULSES_PER_REV),
+ limitSwitch(Sensor3pin3a),
+ solenoid(solenoidPin)
+{
+ slideMotor.braking = true;
+ encoder.reset();
+
+ limitSwitch.rise(callback(this, &Slider::resetheight));
+}
+
+void Slider::resetheight()
+{
+ encoder.reset();
+}
+
+void Slider::slide(float speed)
+{
+ slideMotor.setSpeed(speed);
+}
+
+void Slider::release()
+{
+ solenoid = 1;
+}
