本文共 787 字,大约阅读时间需要 2 分钟。
pulse_wave.hpp:
#includepulse_tb.cpp:#include #include static const int wave_table_len=50;class pulse_wave_class{ public: pulse_wave_class(const float tau): _wave_table(wave_table_len) { // std::vector wave_table(wave_table_len); for(int i=0;i _wave_table;};
using namespace std;#include"pulse_wave.hpp"#include编译:g++ pulse_tb.cpp pulse_wave.hpp -o pulse#include int main(){ pulse_wave_class wave_table(0.5); int i; //wave_table.print(); for(i=0;i<100;i++) //printf("%f\t",wave_table._wave_table[i]); //printf("\n"); if(wave_table._wave_table[i%50]>0.5) printf("sending...\n"); else printf("receiving...\n"); return 0;}
转载地址:http://nmrua.baihongyu.com/