Mohamed Abdelrahman
/
PIDControl
PID Feedback Control
AnalogOut.cpp
- Committer:
- mmohamed
- Date:
- 2019-11-19
- Revision:
- 0:7e0c2b0edbc8
File content as of revision 0:7e0c2b0edbc8:
/* int main() { AnalogOut Aout(p18); PwmOut Pout(p26); while(1) { //Aout=1.3; // 0.5*3.3V = 1.65V Pout=1.0; wait(1); } } #include "mbed.h" #include "time.h" LocalFileSystem local("local"); // Create the local filesystem under the name "local" AnalogIn in(p15); AnalogOut out(p18); DigitalOut led(LED1); Timer t; int main() { FILE *fp = fopen("/local/amp.txt", "w"); // Open "out.txt" on the local file system for writing t.start(); out = 0; for (int i = 0; i<1000; i++){ fprintf(fp, "%f\t%f\n", t.read(), out.read()*3.3); led = 1; if(i == 500){ out = 1.5/3.3; } } fclose(fp); led = 0; } */