part 6 and extra credit
Dependencies: C12832 Servo mbed
Revision 4:9c354b69b590, committed 2015-03-06
- Comitter:
- jaredwil
- Date:
- Fri Mar 06 00:28:38 2015 +0000
- Parent:
- 3:853bc68793d0
- Commit message:
- new;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 853bc68793d0 -r 9c354b69b590 main.cpp --- a/main.cpp Tue Mar 03 23:04:41 2015 +0000 +++ b/main.cpp Fri Mar 06 00:28:38 2015 +0000 @@ -13,6 +13,7 @@ int main() { float val,val2, count = 0; + float pos = 0; //Flash Phone Flash 4 times at close range to start the servo @@ -35,6 +36,8 @@ val2 = 1-val; + + /*application one //even for little light start servo with small steps(low speed) if(val2 > 0.1) { lcd.locate(0,3); @@ -48,5 +51,17 @@ wait(0.2); } } + + */ + if(val2 > 0.1) { + pos += val2*.05; + + if(pos > 1) + pos -= 1; + + s1 = pos; + wait_ms(10); + } + } }