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.
main.cpp@9:fd77a619181d, 2015-12-04 (annotated)
- Committer:
- jasonliujc
- Date:
- Fri Dec 04 06:01:59 2015 +0000
- Revision:
- 9:fd77a619181d
- Parent:
- 8:1ce513eff545
- Child:
- 10:332a4ad5911d
test1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ahmedallibhoy | 0:5b681ac34259 | 1 | #include "mbed.h" |
jasonliujc | 8:1ce513eff545 | 2 | |
jasonliujc | 8:1ce513eff545 | 3 | #include "pid.h" |
jasonliujc | 8:1ce513eff545 | 4 | |
jasonliujc | 8:1ce513eff545 | 5 | Ticker Systicker; |
jasonliujc | 8:1ce513eff545 | 6 | |
jasonliujc | 8:1ce513eff545 | 7 | |
jasonliujc | 8:1ce513eff545 | 8 | //////setting the errors for PID |
jasonliujc | 8:1ce513eff545 | 9 | ctrl obj; |
jasonliujc | 8:1ce513eff545 | 10 | |
jasonliujc | 8:1ce513eff545 | 11 | |
jasonliujc | 8:1ce513eff545 | 12 | |
jasonliujc | 8:1ce513eff545 | 13 | |
jasonliujc | 8:1ce513eff545 | 14 | |
jasonliujc | 8:1ce513eff545 | 15 | |
jasonliujc | 8:1ce513eff545 | 16 | |
jasonliujc | 8:1ce513eff545 | 17 | void systick(){ //rotations |
jasonliujc | 8:1ce513eff545 | 18 | float error = rotationError(); |
jasonliujc | 8:1ce513eff545 | 19 | obj.updateErr(error); |
jasonliujc | 8:1ce513eff545 | 20 | float corr = obj.total(); |
jasonliujc | 8:1ce513eff545 | 21 | leftMotor.addToPwm(corr); |
jasonliujc | 8:1ce513eff545 | 22 | rightMotor.addToPwm(-corr); |
jasonliujc | 8:1ce513eff545 | 23 | |
jasonliujc | 8:1ce513eff545 | 24 | |
jasonliujc | 9:fd77a619181d | 25 | pc.printf("%f",error); |
jasonliujc | 8:1ce513eff545 | 26 | } |
jasonliujc | 8:1ce513eff545 | 27 | |
ahmedallibhoy | 0:5b681ac34259 | 28 | |
ahmedallibhoy | 0:5b681ac34259 | 29 | int main() |
ahmedallibhoy | 0:5b681ac34259 | 30 | { |
jasonliujc | 8:1ce513eff545 | 31 | Systicker.attach_us(&systick,1000); |
jasonliujc | 8:1ce513eff545 | 32 | rightMotor.setPwm(1.0); |
jasonliujc | 8:1ce513eff545 | 33 | leftMotor.setPwm(1.0); |
jasonliujc | 8:1ce513eff545 | 34 | |
jasonliujc | 9:fd77a619181d | 35 | pc.printf("Hello!"); |
jasonliujc | 8:1ce513eff545 | 36 | |
jasonliujc | 8:1ce513eff545 | 37 | |
ahmedallibhoy | 0:5b681ac34259 | 38 | return 0; |
ahmedallibhoy | 0:5b681ac34259 | 39 | } |
jasonliujc | 3:7ca21112a13d | 40 | |
jasonliujc | 3:7ca21112a13d | 41 | /// add something |