Irma Jakic
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include <vector> 00002 #include <cmath> 00003 00004 #include "mbed.h" 00005 00006 #define STEP_SIZE 50 // in ms 00007 #define STEP_HEIGHT 1/10. 00008 #define PI 3.14 00009 00010 AnalogOut osciloscope(PTE30); 00011 00012 int main() { 00013 00014 // initialize steps 00015 vector<float> steps; 00016 00017 float current = 1.; 00018 while(current >= 0.) { 00019 steps.push_back(current); 00020 current -= STEP_HEIGHT; 00021 } 00022 while(current <= 1.) { 00023 steps.push_back(current); 00024 current += STEP_HEIGHT; 00025 } 00026 00027 int current_step = 0; 00028 while(true) { 00029 osciloscope = steps[current_step++ % steps.size()] / 3.3; 00030 //osciloscope = 1.; 00031 wait_us(STEP_SIZE); 00032 } 00033 00034 return 0; // redundant 00035 }
Generated on Sat Aug 6 2022 13:20:27 by
1.7.2