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.
Revision 2:a6b6d93ff3cf, committed 2021-02-04
- Comitter:
- jasonberry
- Date:
- Thu Feb 04 14:45:35 2021 +0000
- Parent:
- 1:0a8f602aeec9
- Commit message:
- servojason
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Thu Feb 04 14:45:35 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/jasonberry/code/Servo/#0ff49e165c90
--- a/main.cpp Wed Dec 10 16:19:08 2014 -0600 +++ b/main.cpp Thu Feb 04 14:45:35 2021 +0000 @@ -14,27 +14,33 @@ * limitations under the License. */ +// Continuously sweep the servo through it's full range #include "mbed.h" +#include "Servo.h" -// Initialize a pins to perform analog input and digital output fucntions -AnalogIn ain(A0); -DigitalOut dout(LED1); +// Initialize a pins to perform SERIAL and digital output fucntions -int main(void) -{ - while (1) { - // test the voltage on the initialized analog pin - // and if greater than 0.3 * VCC set the digital pin - // to a logic 1 otherwise a logic 0 - if(ain > 0.3f) { - dout = 1; - } else { - dout = 0; - } - - // print the percentage and 16 bit normalized values - printf("percentage: %3.3f%%\n", ain.read()*100.0f); - printf("normalized: 0x%04X \n", ain.read_u16()); - wait(0.2f); - } -} +DigitalOut dout(LED1); +Serial pc(USBTX, USBRX); // tx, rx + + +Servo myservo1(p21); +Servo myservo2(p22); + +int main() { + while(1) { + for(int i=0; i<100; i++) { + myservo1 = i/100.0; + myservo2 = i/100.0; + wait(0.01); + + } + for(int i=100; i>0; i--) { + myservo1 = i/100.0; + myservo2 = i/100.0; + wait(0.01); + + } + } + } +
--- a/mbed.bld Wed Dec 10 16:19:08 2014 -0600 +++ b/mbed.bld Thu Feb 04 14:45:35 2021 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ \ No newline at end of file +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file