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: mbed
Diff: main.cpp
- Revision:
- 7:3ad02c0c93a9
- Parent:
- 6:2db8f8299773
- Child:
- 8:31dfba068a15
--- a/main.cpp Thu Jan 28 18:24:39 2016 +0000 +++ b/main.cpp Thu Jan 28 21:56:41 2016 +0000 @@ -37,7 +37,7 @@ Key=0x7F & pc.getc(); wait_ms(100); printf("\n\r-------------------------------------"); - printf("\r\n Pressed Key = %C",Key); + printf("\r\n Pressed Key = %c",Key); printf("\n\r-------------------------------------"); return(Key); } @@ -48,6 +48,7 @@ DOut1 = z; printf("\r\n Logic Value = %x",z); DOut1 = Sw1; + return 0; } int AOut(){ @@ -56,46 +57,49 @@ printf("\n\r Keypress = "); Key=0x7F & pc.getc(); printf("\n\r-------------------------------------"); - printf("\r\n Pressed Key = %s",Key); + printf("\r\n Pressed Key = %c",Key); printf("\n\r-------------------------------------"); AOutput.write(Key); + return 0; } int fAnalogIn(){ AOutput.write(AnaInput1.read()); printf("\n\r Analog Output = %1.4f volts\n", AnaInput1.read() * 3.3f); printf("\n\r Analog Input = %1.4f volts\n", AnaInput2.read() * 3.3f); + return 0; } int PWMOut(){ //Specify Period First - float T; - float PW; + char T[4] = "500"; + char PW[4] = "250"; printf("\n\r\n\r-----Robotics PWM Options-----"); - printf("\n\rEnter a Period in Seconds:"); - pc.scanf("%f",&T); - PWM.period(T); - wait_ms(100); - printf("\n\rEnter a Pulse Width in Seconds:"); - pc.scanf("%f",&PW); - PWM.pulsewidth(PW); - wait_ms(100); - printf("\n\rPeriod in Seconds: %f", T); - printf("\n\rPulse Width in Seconds: %f", PW); + printf("\n\rEnter a Period in milliSeconds (max 999):"); + pc.gets(T,4); + long int P = strtol(PW,NULL,10); + PWM.period_ms(P); + printf("\n\rEnter a Pulse Width in milliSeconds (max 999):"); + pc.scanf(PW,4); + long int W = strtol(PW,NULL,10); + PWM.pulsewidth_ms(W); + printf("\n\rPeriod in Seconds: %i", P); + printf("\n\rPulse Width in Seconds: %i", W); - + return 0; } int ExternalIntInit(){//initialize an external interrupt that causes an LED to toggle its state each //time an external interrupt is detected. +return 0; } int TimerIntInit() { - + return 0; } int LinearOpticalArrayTest(){//repeatedly generates scans of the TSL1401 with a fixed delay between scans @@ -120,6 +124,7 @@ } }while(1); pc.printf("\n\n\rTerminating clocking sequence for linear optical array.\n\r"); +return 0; } int BlueToothTest(){// The objective is to create the hardware and software interface illustrated @@ -128,7 +133,7 @@ //configured, the objective is to enter keystrokes at Terminal A and have them displayed at Terminal //B; and to have keystrokes entered at Terminal A displayed at Terminal B. - +return 0; } void scan(short ScanData[]) { @@ -144,7 +149,7 @@ //LoaCLK=0; } -void main(void) { +int main() { char Key; //Initialize(); while(1) {