Advertisement
KRITSADA

Math from Sk1 Project

Sep 9th, 2018
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <ipst.h>
  2. int r=0,h=0;
  3. float a=1.732,eqa;
  4. void setup(){
  5.   setTextColor(GLCD_SKY);
  6.   glcdMode(1);          
  7. }
  8. void loop(){
  9.     h=map(analog(0),0,1023,0,10);  
  10.     r=map(analog(1),0,1023,0,10);      
  11.     glcd(0,2,"Sk1 Mathematics Project");
  12.     setTextColor(GLCD_WHITE);
  13.     glcd(2,1,"(%d * %d )" , h, r);
  14.     setTextColor(GLCD_ORANGE);
  15.     glcd(6,0,"........Answer is........");
  16.     sleep(10);
  17.     eqa = a*(h*r);                
  18.     setTextColor(GLCD_GREEN);
  19.     glcd(9,1,"%F",eqa);
  20.     setTextColor(GLCD_RED);
  21.     glcd(12,22,"Ans");
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement