-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Pedals as Built-in Devices #206
Comments
@HaydenHour see #207 for test plan details of analog sensors - it should provide a framework for functional testing of your summer task. We can discuss further at our meeting on Monday. |
@HaydenHour Hi Hayden, how it is going? |
@ATATC Hi Terry, its going all right so far. I've decided to do a couple small projects to acclimate myself to using C. In a bit I am planning to do some stuff with the micro Arduino, and eventually beginning to complete the support for pedals as we discussed |
@ATATC I have mostly completed the initial pedal. The video is blurry, but a value between 0-1 is being outputted based on the throttles position. I just want to ticker a bit with the code to make it a bit better. As expected, there are a couple variables in the code that are dependent on certain calibrations (i.e. the initial non 0 rest value being returned). Video.1.mov |
Great work. Now you may want to wrap the code in LEADS framework as I described in the meeting earlier. As an example, this is the voltage sensor's code: #ifndef VOLTAGESENSOR_H
#define VOLTAGESENSOR_H
#include "Device.h"
class VoltageSensor : public Device<float> {
protected:
float _factor;
public:
VoltageSensor(float r1, float r2, int *const pins);
void initialize();
float read();
};
#endif //VOLTAGESENSOR_H #include "VoltageSensor.h"
VoltageSensor::VoltageSensor(float r1, float r2, int *const pins) : _factor((r1 + r2) / r2), Device<float>(pins) {}
void VoltageSensor::initialize() { pinMode(_pins[0], INPUT); }
float VoltageSensor::read() { return (float) analogRead(_pins[0]) * _factor * 5 / 1023; } You can download the library here: https://leads-docs.projectneura.org/en/latest/arduino/index.html. In this example, the dependent variables are Here's a detailed setup for development:
|
Sorry for the confusion, we are recently preparing for a massive launch of breaking changes to our Arduino Library. A corresponding revision will be released then. The newer version shall prevail. You may wait until then. |
Guide to the Next StepPlease read this page first: https://leads-docs.projectneura.org/en/latest/arduino/sketch.html. #ifndef PEDAL_H
#define PEDAL_H
#include "Device.h"
class Pedal : public Device<float> {
protected:
float _restValue, _maxValue;
public:
VoltageSensor(const ArrayList<int> &pins, float restValue, float maxValue);
void initialize(const ArrayList<String> &parentTags) override;
float read() override;
};
#endif // PEDAL_H From there, these methods can be implemented in |
@ATATC Hi Terry, sorry I haven't responded sooner, I have been a bit busy with family. Just to avoid confusion, should I reconfigure my code to resemble what you have shown, or is this something that should be done in a separate file? |
@HaydenHour
Your current code belongs to a |
@qmascarenhas @HaydenHour how are we doing on this? |
As we've discussed, over the summer, @HaydenHour is assigned to add support for pedals.
The text was updated successfully, but these errors were encountered: