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
00001 #include "mbed.h" 00002 00003 #define INPUT_SCALAR (0.01f) 00004 00005 AnalogIn Ain(p19); 00006 AnalogOut Aout(p18); 00007 float i; 00008 00009 int main() 00010 { 00011 while(1) { 00012 for (i=0; i<2; i=i+0.05) { 00013 Aout=0.5+0.5*sin(i*3.14159); // Compute the sine value, + half the range 00014 00015 // Controls the sine wave period 00016 // NOTE to my fellow students: 00017 // in order to get to pot to work as an input to control the frequency, 00018 // I've had to scale the setting of the pot. However, I have not had 00019 // enough scope time to play with the scalar value to fully understand 00020 // the how the pot affects the frequency. So I encourage you to play 00021 // the scalar value to get it to work within the desired frequency range 00022 wait(Ain*INPUT_SCALAR); 00023 } 00024 } 00025 } 00026
Generated on Mon Jul 18 2022 23:55:44 by
1.7.2