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: Control_Yokutan_CANver1 ADXL345_I2C mbed MPU6050
Fork of Souda_Yokutan_ver528TF by
Revision 50:b3a8f8e88c50, committed 2017-03-29
- Comitter:
- YusukeWakuta
- Date:
- Wed Mar 29 04:52:00 2017 +0000
- Branch:
- mpu????????
- Parent:
- 49:8522856fe0cd
- Child:
- 51:eafff055a3f4
- Commit message:
- calcPulse???????????????????
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Mar 29 04:37:27 2017 +0000
+++ b/main.cpp Wed Mar 29 04:52:00 2017 +0000
@@ -235,7 +235,14 @@
double calcPulse(float analog)
{
- return (0.0006+(analog)*(0.00240-0.00060));
+ double min = 0.0006;
+ double max = 0.00240;
+ if(analog >= max)
+ analog = max;
+ else if(analog <= min)
+ analog = min;
+
+ return (min+(analog)*(max-min));
/*
int start=510, end=2390;
while(1) {
@@ -259,7 +266,7 @@
led2 = 1;
if(EDstatePin) {
eruronTrim = eruronAna.read();
- eruronServo.pulsewidth(calcPulse(eruronTrim));
+ eruronServo.pulsewidth(calcPulse(eruronTrim));
} else {
drugTrim = drugAna.read();
drugServo.pulsewidth(calcPulse(drugTrim));
