Advertisement
KRITSADA

ATX2 use Maximum value from zx-sound displayed on bargraph

May 21st, 2019
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <ATX2.h>
  2. int y,i;
  3. long x;
  4. void setup(){
  5.   glcdMode(1);
  6.   setTextSize(3);
  7. }
  8. void loop(){
  9.    x=0;
  10.   // for (i=0;i<100;i++){x=analog(0)+x;}
  11.   // x=x/100;
  12.   // use Maximum Value show on Bargraph
  13.    for (i=0;i<100;i++){x=max(analog(0),x);delay(1);}
  14.    y = map(x,0,1023,0,160);
  15.    glcd(1,0,"%d  ",y);
  16.    glcdFillRect(0,80,y,10,GLCD_RED);
  17.    glcdFillRect(y,80,160-y,10,GLCD_BLACK);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement