Advertisement
desentcare

Untitled

May 18th, 2020
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define ARRAY_SIZE 256
  2.  
  3. void setup(){
  4.     Serial.begin(115200);
  5. }
  6.  
  7. void addMeasuring(float* array, int position, float value)
  8. {
  9.     array[position] = value;
  10. }
  11.  
  12. void sendData(float* array)
  13. {
  14.     for (int i = 0; i < ARRAY_SIZE; i++) {
  15.         Serial.write((int)array[i]);
  16.         delay(1);
  17.     }
  18. }
  19.  
  20.  
  21. void loop(){
  22.     float result[ARRAY_SIZE] = {0};
  23.     for (int i = 0; i < ARRAY_SIZE; i++) {
  24.         addMeasuring(result, i, byte((127*sin(PI*i*0.007843))));
  25.     }
  26.     sendData(result);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement